hypervisor.h 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115
  1. #ifndef _SPARC64_HYPERVISOR_H
  2. #define _SPARC64_HYPERVISOR_H
  3. /* Sun4v hypervisor interfaces and defines.
  4. *
  5. * Hypervisor calls are made via traps to software traps number 0x80
  6. * and above. Registers %o0 to %o5 serve as argument, status, and
  7. * return value registers.
  8. *
  9. * There are two kinds of these traps. First there are the normal
  10. * "fast traps" which use software trap 0x80 and encode the function
  11. * to invoke by number in register %o5. Argument and return value
  12. * handling is as follows:
  13. *
  14. * -----------------------------------------------
  15. * | %o5 | function number | undefined |
  16. * | %o0 | argument 0 | return status |
  17. * | %o1 | argument 1 | return value 1 |
  18. * | %o2 | argument 2 | return value 2 |
  19. * | %o3 | argument 3 | return value 3 |
  20. * | %o4 | argument 4 | return value 4 |
  21. * -----------------------------------------------
  22. *
  23. * The second type are "hyper-fast traps" which encode the function
  24. * number in the software trap number itself. So these use trap
  25. * numbers > 0x80. The register usage for hyper-fast traps is as
  26. * follows:
  27. *
  28. * -----------------------------------------------
  29. * | %o0 | argument 0 | return status |
  30. * | %o1 | argument 1 | return value 1 |
  31. * | %o2 | argument 2 | return value 2 |
  32. * | %o3 | argument 3 | return value 3 |
  33. * | %o4 | argument 4 | return value 4 |
  34. * -----------------------------------------------
  35. *
  36. * Registers providing explicit arguments to the hypervisor calls
  37. * are volatile across the call. Upon return their values are
  38. * undefined unless explicitly specified as containing a particular
  39. * return value by the specific call. The return status is always
  40. * returned in register %o0, zero indicates a successful execution of
  41. * the hypervisor call and other values indicate an error status as
  42. * defined below. So, for example, if a hyper-fast trap takes
  43. * arguments 0, 1, and 2, then %o0, %o1, and %o2 are volatile across
  44. * the call and %o3, %o4, and %o5 would be preserved.
  45. *
  46. * If the hypervisor trap is invalid, or the fast trap function number
  47. * is invalid, HV_EBADTRAP will be returned in %o0. Also, all 64-bits
  48. * of the argument and return values are significant.
  49. */
  50. /* Trap numbers. */
  51. #define HV_FAST_TRAP 0x80
  52. #define HV_MMU_MAP_ADDR_TRAP 0x83
  53. #define HV_MMU_UNMAP_ADDR_TRAP 0x84
  54. #define HV_TTRACE_ADDENTRY_TRAP 0x85
  55. #define HV_CORE_TRAP 0xff
  56. /* Error codes. */
  57. #define HV_EOK 0 /* Successful return */
  58. #define HV_ENOCPU 1 /* Invalid CPU id */
  59. #define HV_ENORADDR 2 /* Invalid real address */
  60. #define HV_ENOINTR 3 /* Invalid interrupt id */
  61. #define HV_EBADPGSZ 4 /* Invalid pagesize encoding */
  62. #define HV_EBADTSB 5 /* Invalid TSB description */
  63. #define HV_EINVAL 6 /* Invalid argument */
  64. #define HV_EBADTRAP 7 /* Invalid function number */
  65. #define HV_EBADALIGN 8 /* Invalid address alignment */
  66. #define HV_EWOULDBLOCK 9 /* Cannot complete w/o blocking */
  67. #define HV_ENOACCESS 10 /* No access to resource */
  68. #define HV_EIO 11 /* I/O error */
  69. #define HV_ECPUERROR 12 /* CPU in error state */
  70. #define HV_ENOTSUPPORTED 13 /* Function not supported */
  71. #define HV_ENOMAP 14 /* No mapping found */
  72. #define HV_ETOOMANY 15 /* Too many items specified */
  73. /* mach_exit()
  74. * TRAP: HV_FAST_TRAP
  75. * FUNCTION: HV_FAST_MACH_EXIT
  76. * ARG0: exit code
  77. * ERRORS: This service does not return.
  78. *
  79. * Stop all CPUs in the virtual domain and place them into the stopped
  80. * state. The 64-bit exit code may be passed to a service entity as
  81. * the domain's exit status. On systems without a service entity, the
  82. * domain will undergo a reset, and the boot firmware will be
  83. * reloaded.
  84. *
  85. * This function will never return to the guest that invokes it.
  86. *
  87. * Note: By convention an exit code of zero denotes a successful exit by
  88. * the guest code. A non-zero exit code denotes a guest specific
  89. * error indication.
  90. *
  91. */
  92. #define HV_FAST_MACH_EXIT 0x00
  93. /* Domain services. */
  94. /* mach_desc()
  95. * TRAP: HV_FAST_TRAP
  96. * FUNCTION: HV_FAST_MACH_DESC
  97. * ARG0: buffer
  98. * ARG1: length
  99. * RET0: status
  100. * RET1: length
  101. * ERRORS: HV_EBADALIGN Buffer is badly aligned
  102. * HV_ENORADDR Buffer is to an illegal real address.
  103. * HV_EINVAL Buffer length is too small for complete
  104. * machine description.
  105. *
  106. * Copy the most current machine description into the buffer indicated
  107. * by the real address in ARG0. The buffer provided must be 16 byte
  108. * aligned. Upon success or HV_EINVAL, this service returns the
  109. * actual size of the machine description in the RET1 return value.
  110. *
  111. * Note: A method of determining the appropriate buffer size for the
  112. * machine description is to first call this service with a buffer
  113. * length of 0 bytes.
  114. */
  115. #define HV_FAST_MACH_DESC 0x01
  116. /* mach_exit()
  117. * TRAP: HV_FAST_TRAP
  118. * FUNCTION: HV_FAST_MACH_SIR
  119. * ERRORS: This service does not return.
  120. *
  121. * Perform a software initiated reset of the virtual machine domain.
  122. * All CPUs are captured as soon as possible, all hardware devices are
  123. * returned to the entry default state, and the domain is restarted at
  124. * the SIR (trap type 0x04) real trap table (RTBA) entry point on one
  125. * of the CPUs. The single CPU restarted is selected as determined by
  126. * platform specific policy. Memory is preserved across this
  127. * operation.
  128. */
  129. #define HV_FAST_MACH_SIR 0x02
  130. /* mach_set_soft_state()
  131. * TRAP: HV_FAST_TRAP
  132. * FUNCTION: HV_FAST_MACH_SET_SOFT_STATE
  133. * ARG0: software state
  134. * ARG1: software state description pointer
  135. * RET0: status
  136. * ERRORS: EINVAL software state not valid or software state
  137. * description is not NULL terminated
  138. * ENORADDR software state description pointer is not a
  139. * valid real address
  140. * EBADALIGNED software state description is not correctly
  141. * aligned
  142. *
  143. * This allows the guest to report it's soft state to the hypervisor. There
  144. * are two primary components to this state. The first part states whether
  145. * the guest software is running or not. The second containts optional
  146. * details specific to the software.
  147. *
  148. * The software state argument is defined below in HV_SOFT_STATE_*, and
  149. * indicates whether the guest is operating normally or in a transitional
  150. * state.
  151. *
  152. * The software state description argument is a real address of a data buffer
  153. * of size 32-bytes aligned on a 32-byte boundary. It is treated as a NULL
  154. * terminated 7-bit ASCII string of up to 31 characters not including the
  155. * NULL termination.
  156. */
  157. #define HV_FAST_MACH_SET_SOFT_STATE 0x03
  158. #define HV_SOFT_STATE_NORMAL 0x01
  159. #define HV_SOFT_STATE_TRANSITION 0x02
  160. /* mach_get_soft_state()
  161. * TRAP: HV_FAST_TRAP
  162. * FUNCTION: HV_FAST_MACH_GET_SOFT_STATE
  163. * ARG0: software state description pointer
  164. * RET0: status
  165. * RET1: software state
  166. * ERRORS: ENORADDR software state description pointer is not a
  167. * valid real address
  168. * EBADALIGNED software state description is not correctly
  169. * aligned
  170. *
  171. * Retrieve the current value of the guest's software state. The rules
  172. * for the software state pointer are the same as for mach_set_soft_state()
  173. * above.
  174. */
  175. #define HV_FAST_MACH_GET_SOFT_STATE 0x04
  176. /* CPU services.
  177. *
  178. * CPUs represent devices that can execute software threads. A single
  179. * chip that contains multiple cores or strands is represented as
  180. * multiple CPUs with unique CPU identifiers. CPUs are exported to
  181. * OBP via the machine description (and to the OS via the OBP device
  182. * tree). CPUs are always in one of three states: stopped, running,
  183. * or error.
  184. *
  185. * A CPU ID is a pre-assigned 16-bit value that uniquely identifies a
  186. * CPU within a logical domain. Operations that are to be performed
  187. * on multiple CPUs specify them via a CPU list. A CPU list is an
  188. * array in real memory, of which each 16-bit word is a CPU ID. CPU
  189. * lists are passed through the API as two arguments. The first is
  190. * the number of entries (16-bit words) in the CPU list, and the
  191. * second is the (real address) pointer to the CPU ID list.
  192. */
  193. /* cpu_start()
  194. * TRAP: HV_FAST_TRAP
  195. * FUNCTION: HV_FAST_CPU_START
  196. * ARG0: CPU ID
  197. * ARG1: PC
  198. * ARG1: RTBA
  199. * ARG1: target ARG0
  200. * RET0: status
  201. * ERRORS: ENOCPU Invalid CPU ID
  202. * EINVAL Target CPU ID is not in the stopped state
  203. * ENORADDR Invalid PC or RTBA real address
  204. * EBADALIGN Unaligned PC or unaligned RTBA
  205. * EWOULDBLOCK Starting resources are not available
  206. *
  207. * Start CPU with given CPU ID with PC in %pc and with a real trap
  208. * base address value of RTBA. The indicated CPU must be in the
  209. * stopped state. The supplied RTBA must be aligned on a 256 byte
  210. * boundary. On successful completion, the specified CPU will be in
  211. * the running state and will be supplied with "target ARG0" in %o0
  212. * and RTBA in %tba.
  213. */
  214. #define HV_FAST_CPU_START 0x10
  215. /* cpu_stop()
  216. * TRAP: HV_FAST_TRAP
  217. * FUNCTION: HV_FAST_CPU_STOP
  218. * ARG0: CPU ID
  219. * RET0: status
  220. * ERRORS: ENOCPU Invalid CPU ID
  221. * EINVAL Target CPU ID is the current cpu
  222. * EINVAL Target CPU ID is not in the running state
  223. * EWOULDBLOCK Stopping resources are not available
  224. * ENOTSUPPORTED Not supported on this platform
  225. *
  226. * The specified CPU is stopped. The indicated CPU must be in the
  227. * running state. On completion, it will be in the stopped state. It
  228. * is not legal to stop the current CPU.
  229. *
  230. * Note: As this service cannot be used to stop the current cpu, this service
  231. * may not be used to stop the last running CPU in a domain. To stop
  232. * and exit a running domain, a guest must use the mach_exit() service.
  233. */
  234. #define HV_FAST_CPU_STOP 0x11
  235. /* cpu_yield()
  236. * TRAP: HV_FAST_TRAP
  237. * FUNCTION: HV_FAST_CPU_YIELD
  238. * RET0: status
  239. * ERRORS: No possible error.
  240. *
  241. * Suspend execution on the current CPU. Execution will resume when
  242. * an interrupt (device, %stick_compare, or cross-call) is targeted to
  243. * the CPU. On some CPUs, this API may be used by the hypervisor to
  244. * save power by disabling hardware strands.
  245. */
  246. #define HV_FAST_CPU_YIELD 0x12
  247. /* cpu_qconf()
  248. * TRAP: HV_FAST_TRAP
  249. * FUNCTION: HV_FAST_CPU_QCONF
  250. * ARG0: queue
  251. * ARG1: base real address
  252. * ARG2: number of entries
  253. * RET0: status
  254. * ERRORS: ENORADDR Invalid base real address
  255. * EINVAL Invalid queue or number of entries is less
  256. * than 2 or too large.
  257. * EBADALIGN Base real address is not correctly aligned
  258. * for size.
  259. *
  260. * Configure the given queue to be placed at the given base real
  261. * address, with the given number of entries. The number of entries
  262. * must be a power of 2. The base real address must be aligned
  263. * exactly to match the queue size. Each queue entry is 64 bytes
  264. * long, so for example a 32 entry queue must be aligned on a 2048
  265. * byte real address boundary.
  266. *
  267. * The specified queue is unconfigured if the number of entries is given
  268. * as zero.
  269. *
  270. * For the current version of this API service, the argument queue is defined
  271. * as follows:
  272. *
  273. * queue description
  274. * ----- -------------------------
  275. * 0x3c cpu mondo queue
  276. * 0x3d device mondo queue
  277. * 0x3e resumable error queue
  278. * 0x3f non-resumable error queue
  279. *
  280. * Note: The maximum number of entries for each queue for a specific cpu may
  281. * be determined from the machine description.
  282. */
  283. #define HV_FAST_CPU_QCONF 0x14
  284. #define HV_CPU_QUEUE_CPU_MONDO 0x3c
  285. #define HV_CPU_QUEUE_DEVICE_MONDO 0x3d
  286. #define HV_CPU_QUEUE_RES_ERROR 0x3e
  287. #define HV_CPU_QUEUE_NONRES_ERROR 0x3f
  288. #ifndef __ASSEMBLY__
  289. extern unsigned long sun4v_cpu_qconf(unsigned long type,
  290. unsigned long queue_paddr,
  291. unsigned long num_queue_entries);
  292. #endif
  293. /* cpu_qinfo()
  294. * TRAP: HV_FAST_TRAP
  295. * FUNCTION: HV_FAST_CPU_QINFO
  296. * ARG0: queue
  297. * RET0: status
  298. * RET1: base real address
  299. * RET1: number of entries
  300. * ERRORS: EINVAL Invalid queue
  301. *
  302. * Return the configuration info for the given queue. The base real
  303. * address and number of entries of the defined queue are returned.
  304. * The queue argument values are the same as for cpu_qconf() above.
  305. *
  306. * If the specified queue is a valid queue number, but no queue has
  307. * been defined, the number of entries will be set to zero and the
  308. * base real address returned is undefined.
  309. */
  310. #define HV_FAST_CPU_QINFO 0x15
  311. /* cpu_mondo_send()
  312. * TRAP: HV_FAST_TRAP
  313. * FUNCTION: HV_FAST_CPU_MONDO_SEND
  314. * ARG0-1: CPU list
  315. * ARG2: data real address
  316. * RET0: status
  317. * ERRORS: EBADALIGN Mondo data is not 64-byte aligned or CPU list
  318. * is not 2-byte aligned.
  319. * ENORADDR Invalid data mondo address, or invalid cpu list
  320. * address.
  321. * ENOCPU Invalid cpu in CPU list
  322. * EWOULDBLOCK Some or all of the listed CPUs did not receive
  323. * the mondo
  324. * EINVAL CPU list includes caller's CPU ID
  325. *
  326. * Send a mondo interrupt to the CPUs in the given CPU list with the
  327. * 64-bytes at the given data real address. The data must be 64-byte
  328. * aligned. The mondo data will be delivered to the cpu_mondo queues
  329. * of the recipient CPUs.
  330. *
  331. * In all cases, error or not, the CPUs in the CPU list to which the
  332. * mondo has been successfully delivered will be indicated by having
  333. * their entry in CPU list updated with the value 0xffff.
  334. */
  335. #define HV_FAST_CPU_MONDO_SEND 0x42
  336. /* cpu_myid()
  337. * TRAP: HV_FAST_TRAP
  338. * FUNCTION: HV_FAST_CPU_MYID
  339. * RET0: status
  340. * RET1: CPU ID
  341. * ERRORS: No errors defined.
  342. *
  343. * Return the hypervisor ID handle for the current CPU. Use by a
  344. * virtual CPU to discover it's own identity.
  345. */
  346. #define HV_FAST_CPU_MYID 0x16
  347. /* cpu_state()
  348. * TRAP: HV_FAST_TRAP
  349. * FUNCTION: HV_FAST_CPU_STATE
  350. * ARG0: CPU ID
  351. * RET0: status
  352. * RET1: state
  353. * ERRORS: ENOCPU Invalid CPU ID
  354. *
  355. * Retrieve the current state of the CPU with the given CPU ID.
  356. */
  357. #define HV_FAST_CPU_STATE 0x17
  358. #define HV_CPU_STATE_STOPPED 0x01
  359. #define HV_CPU_STATE_RUNNING 0x02
  360. #define HV_CPU_STATE_ERROR 0x03
  361. /* cpu_set_rtba()
  362. * TRAP: HV_FAST_TRAP
  363. * FUNCTION: HV_FAST_CPU_SET_RTBA
  364. * ARG0: RTBA
  365. * RET0: status
  366. * RET1: previous RTBA
  367. * ERRORS: ENORADDR Invalid RTBA real address
  368. * EBADALIGN RTBA is incorrectly aligned for a trap table
  369. *
  370. * Set the real trap base address of the local cpu to the given RTBA.
  371. * The supplied RTBA must be aligned on a 256 byte boundary. Upon
  372. * success the previous value of the RTBA is returned in RET1.
  373. *
  374. * Note: This service does not affect %tba
  375. */
  376. #define HV_FAST_CPU_SET_RTBA 0x18
  377. /* cpu_set_rtba()
  378. * TRAP: HV_FAST_TRAP
  379. * FUNCTION: HV_FAST_CPU_GET_RTBA
  380. * RET0: status
  381. * RET1: previous RTBA
  382. * ERRORS: No possible error.
  383. *
  384. * Returns the current value of RTBA in RET1.
  385. */
  386. #define HV_FAST_CPU_GET_RTBA 0x19
  387. /* MMU services.
  388. *
  389. * Layout of a TSB description for mmu_tsb_ctx{,non}0() calls.
  390. */
  391. #ifndef __ASSEMBLY__
  392. struct hv_tsb_descr {
  393. unsigned short pgsz_idx;
  394. unsigned short assoc;
  395. unsigned int num_ttes; /* in TTEs */
  396. unsigned int ctx_idx;
  397. unsigned int pgsz_mask;
  398. unsigned long tsb_base;
  399. unsigned long resv;
  400. };
  401. #endif
  402. #define HV_TSB_DESCR_PGSZ_IDX_OFFSET 0x00
  403. #define HV_TSB_DESCR_ASSOC_OFFSET 0x02
  404. #define HV_TSB_DESCR_NUM_TTES_OFFSET 0x04
  405. #define HV_TSB_DESCR_CTX_IDX_OFFSET 0x08
  406. #define HV_TSB_DESCR_PGSZ_MASK_OFFSET 0x0c
  407. #define HV_TSB_DESCR_TSB_BASE_OFFSET 0x10
  408. #define HV_TSB_DESCR_RESV_OFFSET 0x18
  409. /* Page size bitmask. */
  410. #define HV_PGSZ_MASK_8K (1 << 0)
  411. #define HV_PGSZ_MASK_64K (1 << 1)
  412. #define HV_PGSZ_MASK_512K (1 << 2)
  413. #define HV_PGSZ_MASK_4MB (1 << 3)
  414. #define HV_PGSZ_MASK_32MB (1 << 4)
  415. #define HV_PGSZ_MASK_256MB (1 << 5)
  416. #define HV_PGSZ_MASK_2GB (1 << 6)
  417. #define HV_PGSZ_MASK_16GB (1 << 7)
  418. /* Page size index. The value given in the TSB descriptor must correspond
  419. * to the smallest page size specified in the pgsz_mask page size bitmask.
  420. */
  421. #define HV_PGSZ_IDX_8K 0
  422. #define HV_PGSZ_IDX_64K 1
  423. #define HV_PGSZ_IDX_512K 2
  424. #define HV_PGSZ_IDX_4MB 3
  425. #define HV_PGSZ_IDX_32MB 4
  426. #define HV_PGSZ_IDX_256MB 5
  427. #define HV_PGSZ_IDX_2GB 6
  428. #define HV_PGSZ_IDX_16GB 7
  429. /* MMU fault status area.
  430. *
  431. * MMU related faults have their status and fault address information
  432. * placed into a memory region made available by privileged code. Each
  433. * virtual processor must make a mmu_fault_area_conf() call to tell the
  434. * hypervisor where that processor's fault status should be stored.
  435. *
  436. * The fault status block is a multiple of 64-bytes and must be aligned
  437. * on a 64-byte boundary.
  438. */
  439. #ifndef __ASSEMBLY__
  440. struct hv_fault_status {
  441. unsigned long i_fault_type;
  442. unsigned long i_fault_addr;
  443. unsigned long i_fault_ctx;
  444. unsigned long i_reserved[5];
  445. unsigned long d_fault_type;
  446. unsigned long d_fault_addr;
  447. unsigned long d_fault_ctx;
  448. unsigned long d_reserved[5];
  449. };
  450. #endif
  451. #define HV_FAULT_I_TYPE_OFFSET 0x00
  452. #define HV_FAULT_I_ADDR_OFFSET 0x08
  453. #define HV_FAULT_I_CTX_OFFSET 0x10
  454. #define HV_FAULT_D_TYPE_OFFSET 0x40
  455. #define HV_FAULT_D_ADDR_OFFSET 0x48
  456. #define HV_FAULT_D_CTX_OFFSET 0x50
  457. #define HV_FAULT_TYPE_FAST_MISS 1
  458. #define HV_FAULT_TYPE_FAST_PROT 2
  459. #define HV_FAULT_TYPE_MMU_MISS 3
  460. #define HV_FAULT_TYPE_INV_RA 4
  461. #define HV_FAULT_TYPE_PRIV_VIOL 5
  462. #define HV_FAULT_TYPE_PROT_VIOL 6
  463. #define HV_FAULT_TYPE_NFO 7
  464. #define HV_FAULT_TYPE_NFO_SEFF 8
  465. #define HV_FAULT_TYPE_INV_VA 9
  466. #define HV_FAULT_TYPE_INV_ASI 10
  467. #define HV_FAULT_TYPE_NC_ATOMIC 11
  468. #define HV_FAULT_TYPE_PRIV_ACT 12
  469. #define HV_FAULT_TYPE_RESV1 13
  470. #define HV_FAULT_TYPE_UNALIGNED 14
  471. #define HV_FAULT_TYPE_INV_PGSZ 15
  472. /* Values 16 --> -2 are reserved. */
  473. #define HV_FAULT_TYPE_MULTIPLE -1
  474. /* Flags argument for mmu_{map,unmap}_addr(), mmu_demap_{page,context,all}(),
  475. * and mmu_{map,unmap}_perm_addr().
  476. */
  477. #define HV_MMU_DMMU 0x01
  478. #define HV_MMU_IMMU 0x02
  479. #define HV_MMU_ALL (HV_MMU_DMMU | HV_MMU_IMMU)
  480. /* mmu_map_addr()
  481. * TRAP: HV_MMU_MAP_ADDR_TRAP
  482. * ARG0: virtual address
  483. * ARG1: mmu context
  484. * ARG2: TTE
  485. * ARG3: flags (HV_MMU_{IMMU,DMMU})
  486. * ERRORS: EINVAL Invalid virtual address, mmu context, or flags
  487. * EBADPGSZ Invalid page size value
  488. * ENORADDR Invalid real address in TTE
  489. *
  490. * Create a non-permanent mapping using the given TTE, virtual
  491. * address, and mmu context. The flags argument determines which
  492. * (data, or instruction, or both) TLB the mapping gets loaded into.
  493. *
  494. * The behavior is undefined if the valid bit is clear in the TTE.
  495. *
  496. * Note: This API call is for privileged code to specify temporary translation
  497. * mappings without the need to create and manage a TSB.
  498. */
  499. /* mmu_unmap_addr()
  500. * TRAP: HV_MMU_UNMAP_ADDR_TRAP
  501. * ARG0: virtual address
  502. * ARG1: mmu context
  503. * ARG2: flags (HV_MMU_{IMMU,DMMU})
  504. * ERRORS: EINVAL Invalid virtual address, mmu context, or flags
  505. *
  506. * Demaps the given virtual address in the given mmu context on this
  507. * CPU. This function is intended to be used to demap pages mapped
  508. * with mmu_map_addr. This service is equivalent to invoking
  509. * mmu_demap_page() with only the current CPU in the CPU list. The
  510. * flags argument determines which (data, or instruction, or both) TLB
  511. * the mapping gets unmapped from.
  512. *
  513. * Attempting to perform an unmap operation for a previously defined
  514. * permanent mapping will have undefined results.
  515. */
  516. /* mmu_tsb_ctx0()
  517. * TRAP: HV_FAST_TRAP
  518. * FUNCTION: HV_FAST_MMU_TSB_CTX0
  519. * ARG0: number of TSB descriptions
  520. * ARG1: TSB descriptions pointer
  521. * RET0: status
  522. * ERRORS: ENORADDR Invalid TSB descriptions pointer or
  523. * TSB base within a descriptor
  524. * EBADALIGN TSB descriptions pointer is not aligned
  525. * to an 8-byte boundary, or TSB base
  526. * within a descriptor is not aligned for
  527. * the given TSB size
  528. * EBADPGSZ Invalid page size in a TSB descriptor
  529. * EBADTSB Invalid associativity or size in a TSB
  530. * descriptor
  531. * EINVAL Invalid number of TSB descriptions, or
  532. * invalid context index in a TSB
  533. * descriptor, or index page size not
  534. * equal to smallest page size in page
  535. * size bitmask field.
  536. *
  537. * Configures the TSBs for the current CPU for virtual addresses with
  538. * context zero. The TSB descriptions pointer is a pointer to an
  539. * array of the given number of TSB descriptions.
  540. *
  541. * Note: The maximum number of TSBs available to a virtual CPU is given by the
  542. * mmu-max-#tsbs property of the cpu's corresponding "cpu" node in the
  543. * machine description.
  544. */
  545. #define HV_FAST_MMU_TSB_CTX0 0x20
  546. /* mmu_tsb_ctxnon0()
  547. * TRAP: HV_FAST_TRAP
  548. * FUNCTION: HV_FAST_MMU_TSB_CTXNON0
  549. * ARG0: number of TSB descriptions
  550. * ARG1: TSB descriptions pointer
  551. * RET0: status
  552. * ERRORS: Same as for mmu_tsb_ctx0() above.
  553. *
  554. * Configures the TSBs for the current CPU for virtual addresses with
  555. * non-zero contexts. The TSB descriptions pointer is a pointer to an
  556. * array of the given number of TSB descriptions.
  557. *
  558. * Note: A maximum of 16 TSBs may be specified in the TSB description list.
  559. */
  560. #define HV_FAST_MMU_TSB_CTXNON0 0x21
  561. /* mmu_demap_page()
  562. * TRAP: HV_FAST_TRAP
  563. * FUNCTION: HV_FAST_MMU_DEMAP_PAGE
  564. * ARG0: reserved, must be zero
  565. * ARG1: reserved, must be zero
  566. * ARG2: virtual address
  567. * ARG3: mmu context
  568. * ARG4: flags (HV_MMU_{IMMU,DMMU})
  569. * RET0: status
  570. * ERRORS: EINVAL Invalid virutal address, context, or
  571. * flags value
  572. * ENOTSUPPORTED ARG0 or ARG1 is non-zero
  573. *
  574. * Demaps any page mapping of the given virtual address in the given
  575. * mmu context for the current virtual CPU. Any virtually tagged
  576. * caches are guaranteed to be kept consistent. The flags argument
  577. * determines which TLB (instruction, or data, or both) participate in
  578. * the operation.
  579. *
  580. * ARG0 and ARG1 are both reserved and must be set to zero.
  581. */
  582. #define HV_FAST_MMU_DEMAP_PAGE 0x22
  583. /* mmu_demap_ctx()
  584. * TRAP: HV_FAST_TRAP
  585. * FUNCTION: HV_FAST_MMU_DEMAP_CTX
  586. * ARG0: reserved, must be zero
  587. * ARG1: reserved, must be zero
  588. * ARG2: mmu context
  589. * ARG3: flags (HV_MMU_{IMMU,DMMU})
  590. * RET0: status
  591. * ERRORS: EINVAL Invalid context or flags value
  592. * ENOTSUPPORTED ARG0 or ARG1 is non-zero
  593. *
  594. * Demaps all non-permanent virtual page mappings previously specified
  595. * for the given context for the current virtual CPU. Any virtual
  596. * tagged caches are guaranteed to be kept consistent. The flags
  597. * argument determines which TLB (instruction, or data, or both)
  598. * participate in the operation.
  599. *
  600. * ARG0 and ARG1 are both reserved and must be set to zero.
  601. */
  602. #define HV_FAST_MMU_DEMAP_CTX 0x23
  603. /* mmu_demap_all()
  604. * TRAP: HV_FAST_TRAP
  605. * FUNCTION: HV_FAST_MMU_DEMAP_ALL
  606. * ARG0: reserved, must be zero
  607. * ARG1: reserved, must be zero
  608. * ARG2: flags (HV_MMU_{IMMU,DMMU})
  609. * RET0: status
  610. * ERRORS: EINVAL Invalid flags value
  611. * ENOTSUPPORTED ARG0 or ARG1 is non-zero
  612. *
  613. * Demaps all non-permanent virtual page mappings previously specified
  614. * for the current virtual CPU. Any virtual tagged caches are
  615. * guaranteed to be kept consistent. The flags argument determines
  616. * which TLB (instruction, or data, or both) participate in the
  617. * operation.
  618. *
  619. * ARG0 and ARG1 are both reserved and must be set to zero.
  620. */
  621. #define HV_FAST_MMU_DEMAP_ALL 0x24
  622. /* mmu_map_perm_addr()
  623. * TRAP: HV_FAST_TRAP
  624. * FUNCTION: HV_FAST_MMU_MAP_PERM_ADDR
  625. * ARG0: virtual address
  626. * ARG1: reserved, must be zero
  627. * ARG2: TTE
  628. * ARG3: flags (HV_MMU_{IMMU,DMMU})
  629. * RET0: status
  630. * ERRORS: EINVAL Invalid virutal address or flags value
  631. * EBADPGSZ Invalid page size value
  632. * ENORADDR Invalid real address in TTE
  633. * ETOOMANY Too many mappings (max of 8 reached)
  634. *
  635. * Create a permanent mapping using the given TTE and virtual address
  636. * for context 0 on the calling virtual CPU. A maximum of 8 such
  637. * permanent mappings may be specified by privileged code. Mappings
  638. * may be removed with mmu_unmap_perm_addr().
  639. *
  640. * The behavior is undefined if a TTE with the valid bit clear is given.
  641. *
  642. * Note: This call is used to specify address space mappings for which
  643. * privileged code does not expect to receive misses. For example,
  644. * this mechanism can be used to map kernel nucleus code and data.
  645. */
  646. #define HV_FAST_MMU_MAP_PERM_ADDR 0x25
  647. /* mmu_fault_area_conf()
  648. * TRAP: HV_FAST_TRAP
  649. * FUNCTION: HV_FAST_MMU_FAULT_AREA_CONF
  650. * ARG0: real address
  651. * RET0: status
  652. * RET1: previous mmu fault area real address
  653. * ERRORS: ENORADDR Invalid real address
  654. * EBADALIGN Invalid alignment for fault area
  655. *
  656. * Configure the MMU fault status area for the calling CPU. A 64-byte
  657. * aligned real address specifies where MMU fault status information
  658. * is placed. The return value is the previously specified area, or 0
  659. * for the first invocation. Specifying a fault area at real address
  660. * 0 is not allowed.
  661. */
  662. #define HV_FAST_MMU_FAULT_AREA_CONF 0x26
  663. /* mmu_enable()
  664. * TRAP: HV_FAST_TRAP
  665. * FUNCTION: HV_FAST_MMU_ENABLE
  666. * ARG0: enable flag
  667. * ARG1: return target address
  668. * RET0: status
  669. * ERRORS: ENORADDR Invalid real address when disabling
  670. * translation.
  671. * EBADALIGN The return target address is not
  672. * aligned to an instruction.
  673. * EINVAL The enable flag request the current
  674. * operating mode (e.g. disable if already
  675. * disabled)
  676. *
  677. * Enable or disable virtual address translation for the calling CPU
  678. * within the virtual machine domain. If the enable flag is zero,
  679. * translation is disabled, any non-zero value will enable
  680. * translation.
  681. *
  682. * When this function returns, the newly selected translation mode
  683. * will be active. If the mmu is being enabled, then the return
  684. * target address is a virtual address else it is a real address.
  685. *
  686. * Upon successful completion, control will be returned to the given
  687. * return target address (ie. the cpu will jump to that address). On
  688. * failure, the previous mmu mode remains and the trap simply returns
  689. * as normal with the appropriate error code in RET0.
  690. */
  691. #define HV_FAST_MMU_ENABLE 0x27
  692. /* mmu_unmap_perm_addr()
  693. * TRAP: HV_FAST_TRAP
  694. * FUNCTION: HV_FAST_MMU_UNMAP_PERM_ADDR
  695. * ARG0: virtual address
  696. * ARG1: reserved, must be zero
  697. * ARG2: flags (HV_MMU_{IMMU,DMMU})
  698. * RET0: status
  699. * ERRORS: EINVAL Invalid virutal address or flags value
  700. * ENOMAP Specified mapping was not found
  701. *
  702. * Demaps any permanent page mapping (established via
  703. * mmu_map_perm_addr()) at the given virtual address for context 0 on
  704. * the current virtual CPU. Any virtual tagged caches are guaranteed
  705. * to be kept consistent.
  706. */
  707. #define HV_FAST_MMU_UNMAP_PERM_ADDR 0x28
  708. /* mmu_tsb_ctx0_info()
  709. * TRAP: HV_FAST_TRAP
  710. * FUNCTION: HV_FAST_MMU_TSB_CTX0_INFO
  711. * ARG0: max TSBs
  712. * ARG1: buffer pointer
  713. * RET0: status
  714. * RET1: number of TSBs
  715. * ERRORS: EINVAL Supplied buffer is too small
  716. * EBADALIGN The buffer pointer is badly aligned
  717. * ENORADDR Invalid real address for buffer pointer
  718. *
  719. * Return the TSB configuration as previous defined by mmu_tsb_ctx0()
  720. * into the provided buffer. The size of the buffer is given in ARG1
  721. * in terms of the number of TSB description entries.
  722. *
  723. * Upon return, RET1 always contains the number of TSB descriptions
  724. * previously configured. If zero TSBs were configured, EOK is
  725. * returned with RET1 containing 0.
  726. */
  727. #define HV_FAST_MMU_TSB_CTX0_INFO 0x29
  728. /* mmu_tsb_ctxnon0_info()
  729. * TRAP: HV_FAST_TRAP
  730. * FUNCTION: HV_FAST_MMU_TSB_CTXNON0_INFO
  731. * ARG0: max TSBs
  732. * ARG1: buffer pointer
  733. * RET0: status
  734. * RET1: number of TSBs
  735. * ERRORS: EINVAL Supplied buffer is too small
  736. * EBADALIGN The buffer pointer is badly aligned
  737. * ENORADDR Invalid real address for buffer pointer
  738. *
  739. * Return the TSB configuration as previous defined by
  740. * mmu_tsb_ctxnon0() into the provided buffer. The size of the buffer
  741. * is given in ARG1 in terms of the number of TSB description entries.
  742. *
  743. * Upon return, RET1 always contains the number of TSB descriptions
  744. * previously configured. If zero TSBs were configured, EOK is
  745. * returned with RET1 containing 0.
  746. */
  747. #define HV_FAST_MMU_TSB_CTXNON0_INFO 0x2a
  748. /* mmu_fault_area_info()
  749. * TRAP: HV_FAST_TRAP
  750. * FUNCTION: HV_FAST_MMU_FAULT_AREA_INFO
  751. * RET0: status
  752. * RET1: fault area real address
  753. * ERRORS: No errors defined.
  754. *
  755. * Return the currently defined MMU fault status area for the current
  756. * CPU. The real address of the fault status area is returned in
  757. * RET1, or 0 is returned in RET1 if no fault status area is defined.
  758. *
  759. * Note: mmu_fault_area_conf() may be called with the return value (RET1)
  760. * from this service if there is a need to save and restore the fault
  761. * area for a cpu.
  762. */
  763. #define HV_FAST_MMU_FAULT_AREA_INFO 0x2b
  764. /* Cache and Memory services. */
  765. /* mem_scrub()
  766. * TRAP: HV_FAST_TRAP
  767. * FUNCTION: HV_FAST_MEM_SCRUB
  768. * ARG0: real address
  769. * ARG1: length
  770. * RET0: status
  771. * RET1: length scrubbed
  772. * ERRORS: ENORADDR Invalid real address
  773. * EBADALIGN Start address or length are not correctly
  774. * aligned
  775. * EINVAL Length is zero
  776. *
  777. * Zero the memory contents in the range real address to real address
  778. * plus length minus 1. Also, valid ECC will be generated for that
  779. * memory address range. Scrubbing is started at the given real
  780. * address, but may not scrub the entire given length. The actual
  781. * length scrubbed will be returned in RET1.
  782. *
  783. * The real address and length must be aligned on an 8K boundary, or
  784. * contain the start address and length from a sun4v error report.
  785. *
  786. * Note: There are two uses for this function. The first use is to block clear
  787. * and initialize memory and the second is to scrub an u ncorrectable
  788. * error reported via a resumable or non-resumable trap. The second
  789. * use requires the arguments to be equal to the real address and length
  790. * provided in a sun4v memory error report.
  791. */
  792. #define HV_FAST_MEM_SCRUB 0x31
  793. /* mem_sync()
  794. * TRAP: HV_FAST_TRAP
  795. * FUNCTION: HV_FAST_MEM_SYNC
  796. * ARG0: real address
  797. * ARG1: length
  798. * RET0: status
  799. * RET1: length synced
  800. * ERRORS: ENORADDR Invalid real address
  801. * EBADALIGN Start address or length are not correctly
  802. * aligned
  803. * EINVAL Length is zero
  804. *
  805. * Force the next access within the real address to real address plus
  806. * length minus 1 to be fetches from main system memory. Less than
  807. * the given length may be synced, the actual amount synced is
  808. * returned in RET1. The real address and length must be aligned on
  809. * an 8K boundary.
  810. */
  811. #define HV_FAST_MEM_SYNC 0x32
  812. /* Time of day services.
  813. *
  814. * The hypervisor maintains the time of day on a per-domain basis.
  815. * Changing the time of day in one domain does not affect the time of
  816. * day on any other domain.
  817. *
  818. * Time is described by a single unsigned 64-bit word which is the
  819. * number of seconds since the UNIX Epoch (00:00:00 UTC, January 1,
  820. * 1970).
  821. */
  822. /* tod_get()
  823. * TRAP: HV_FAST_TRAP
  824. * FUNCTION: HV_FAST_TOD_GET
  825. * RET0: status
  826. * RET1: TOD
  827. * ERRORS: EWOULDBLOCK TOD resource is temporarily unavailable
  828. * ENOTSUPPORTED If TOD not supported on this platform
  829. *
  830. * Return the current time of day. May block if TOD access is
  831. * temporarily not possible.
  832. */
  833. #define HV_FAST_TOD_GET 0x50
  834. /* tod_set()
  835. * TRAP: HV_FAST_TRAP
  836. * FUNCTION: HV_FAST_TOD_SET
  837. * ARG0: TOD
  838. * RET0: status
  839. * ERRORS: EWOULDBLOCK TOD resource is temporarily unavailable
  840. * ENOTSUPPORTED If TOD not supported on this platform
  841. *
  842. * The current time of day is set to the value specified in ARG0. May
  843. * block if TOD access is temporarily not possible.
  844. */
  845. #define HV_FAST_TOD_SET 0x51
  846. /* Console services */
  847. /* con_getchar()
  848. * TRAP: HV_FAST_TRAP
  849. * FUNCTION: HV_FAST_CONS_GETCHAR
  850. * RET0: status
  851. * RET1: character
  852. * ERRORS: EWOULDBLOCK No character available.
  853. *
  854. * Returns a character from the console device. If no character is
  855. * available then an EWOULDBLOCK error is returned. If a character is
  856. * available, then the returned status is EOK and the character value
  857. * is in RET1.
  858. *
  859. * A virtual BREAK is represented by the 64-bit value -1.
  860. *
  861. * A virtual HUP signal is represented by the 64-bit value -2.
  862. */
  863. #define HV_FAST_CONS_GETCHAR 0x60
  864. /* con_putchar()
  865. * TRAP: HV_FAST_TRAP
  866. * FUNCTION: HV_FAST_CONS_PUTCHAR
  867. * ARG0: character
  868. * RET0: status
  869. * ERRORS: EINVAL Illegal character
  870. * EWOULDBLOCK Output buffer currently full, would block
  871. *
  872. * Send a character to the console device. Only character values
  873. * between 0 and 255 may be used. Values outside this range are
  874. * invalid except for the 64-bit value -1 which is used to send a
  875. * virtual BREAK.
  876. */
  877. #define HV_FAST_CONS_PUTCHAR 0x61
  878. /* Trap trace services.
  879. *
  880. * The hypervisor provides a trap tracing capability for privileged
  881. * code running on each virtual CPU. Privileged code provides a
  882. * round-robin trap trace queue within which the hypervisor writes
  883. * 64-byte entries detailing hyperprivileged traps taken n behalf of
  884. * privileged code. This is provided as a debugging capability for
  885. * privileged code.
  886. *
  887. * The trap trace control structure is 64-bytes long and placed at the
  888. * start (offset 0) of the trap trace buffer, and is described as
  889. * follows:
  890. */
  891. #ifndef __ASSEMBLY__
  892. struct hv_trap_trace_control {
  893. unsigned long head_offset;
  894. unsigned long tail_offset;
  895. unsigned long __reserved[0x30 / sizeof(unsigned long)];
  896. };
  897. #endif
  898. #define HV_TRAP_TRACE_CTRL_HEAD_OFFSET 0x00
  899. #define HV_TRAP_TRACE_CTRL_TAIL_OFFSET 0x08
  900. /* The head offset is the offset of the most recently completed entry
  901. * in the trap-trace buffer. The tail offset is the offset of the
  902. * next entry to be written. The control structure is owned and
  903. * modified by the hypervisor. A guest may not modify the control
  904. * structure contents. Attempts to do so will result in undefined
  905. * behavior for the guest.
  906. *
  907. * Each trap trace buffer entry is layed out as follows:
  908. */
  909. #ifndef __ASSEMBLY__
  910. struct hv_trap_trace_entry {
  911. unsigned char type; /* Hypervisor or guest entry? */
  912. unsigned char hpstate; /* Hyper-privileged state */
  913. unsigned char tl; /* Trap level */
  914. unsigned char gl; /* Global register level */
  915. unsigned short tt; /* Trap type */
  916. unsigned short tag; /* Extended trap identifier */
  917. unsigned long tstate; /* Trap state */
  918. unsigned long tick; /* Tick */
  919. unsigned long tpc; /* Trap PC */
  920. unsigned long f1; /* Entry specific */
  921. unsigned long f2; /* Entry specific */
  922. unsigned long f3; /* Entry specific */
  923. unsigned long f4; /* Entry specific */
  924. };
  925. #endif
  926. #define HV_TRAP_TRACE_ENTRY_TYPE 0x00
  927. #define HV_TRAP_TRACE_ENTRY_HPSTATE 0x01
  928. #define HV_TRAP_TRACE_ENTRY_TL 0x02
  929. #define HV_TRAP_TRACE_ENTRY_GL 0x03
  930. #define HV_TRAP_TRACE_ENTRY_TT 0x04
  931. #define HV_TRAP_TRACE_ENTRY_TAG 0x06
  932. #define HV_TRAP_TRACE_ENTRY_TSTATE 0x08
  933. #define HV_TRAP_TRACE_ENTRY_TICK 0x10
  934. #define HV_TRAP_TRACE_ENTRY_TPC 0x18
  935. #define HV_TRAP_TRACE_ENTRY_F1 0x20
  936. #define HV_TRAP_TRACE_ENTRY_F2 0x28
  937. #define HV_TRAP_TRACE_ENTRY_F3 0x30
  938. #define HV_TRAP_TRACE_ENTRY_F4 0x38
  939. /* The type field is encoded as follows. */
  940. #define HV_TRAP_TYPE_UNDEF 0x00 /* Entry content undefined */
  941. #define HV_TRAP_TYPE_HV 0x01 /* Hypervisor trap entry */
  942. #define HV_TRAP_TYPE_GUEST 0xff /* Added via ttrace_addentry() */
  943. /* ttrace_buf_conf()
  944. * TRAP: HV_FAST_TRAP
  945. * FUNCTION: HV_FAST_TTRACE_BUF_CONF
  946. * ARG0: real address
  947. * ARG1: number of entries
  948. * RET0: status
  949. * RET1: number of entries
  950. * ERRORS: ENORADDR Invalid real address
  951. * EINVAL Size is too small
  952. * EBADALIGN Real address not aligned on 64-byte boundary
  953. *
  954. * Requests hypervisor trap tracing and declares a virtual CPU's trap
  955. * trace buffer to the hypervisor. The real address supplies the real
  956. * base address of the trap trace queue and must be 64-byte aligned.
  957. * Specifying a value of 0 for the number of entries disables trap
  958. * tracing for the calling virtual CPU. The buffer allocated must be
  959. * sized for a power of two number of 64-byte trap trace entries plus
  960. * an initial 64-byte control structure.
  961. *
  962. * This may be invoked any number of times so that a virtual CPU may
  963. * relocate a trap trace buffer or create "snapshots" of information.
  964. *
  965. * If the real address is illegal or badly aligned, then trap tracing
  966. * is disabled and an error is returned.
  967. *
  968. * Upon failure with EINVAL, this service call returns in RET1 the
  969. * minimum number of buffer entries required. Upon other failures
  970. * RET1 is undefined.
  971. */
  972. #define HV_FAST_TTRACE_BUF_CONF 0x90
  973. /* ttrace_buf_info()
  974. * TRAP: HV_FAST_TRAP
  975. * FUNCTION: HV_FAST_TTRACE_BUF_INFO
  976. * RET0: status
  977. * RET1: real address
  978. * RET2: size
  979. * ERRORS: None defined.
  980. *
  981. * Returns the size and location of the previously declared trap-trace
  982. * buffer. In the event that no buffer was previously defined, or the
  983. * buffer is disabled, this call will return a size of zero bytes.
  984. */
  985. #define HV_FAST_TTRACE_BUF_INFO 0x91
  986. /* ttrace_enable()
  987. * TRAP: HV_FAST_TRAP
  988. * FUNCTION: HV_FAST_TTRACE_ENABLE
  989. * ARG0: enable
  990. * RET0: status
  991. * RET1: previous enable state
  992. * ERRORS: EINVAL No trap trace buffer currently defined
  993. *
  994. * Enable or disable trap tracing, and return the previous enabled
  995. * state in RET1. Future systems may define various flags for the
  996. * enable argument (ARG0), for the moment a guest should pass
  997. * "(uint64_t) -1" to enable, and "(uint64_t) 0" to disable all
  998. * tracing - which will ensure future compatability.
  999. */
  1000. #define HV_FAST_TTRACE_ENABLE 0x92
  1001. /* ttrace_freeze()
  1002. * TRAP: HV_FAST_TRAP
  1003. * FUNCTION: HV_FAST_TTRACE_FREEZE
  1004. * ARG0: freeze
  1005. * RET0: status
  1006. * RET1: previous freeze state
  1007. * ERRORS: EINVAL No trap trace buffer currently defined
  1008. *
  1009. * Freeze or unfreeze trap tracing, returning the previous freeze
  1010. * state in RET1. A guest should pass a non-zero value to freeze and
  1011. * a zero value to unfreeze all tracing. The returned previous state
  1012. * is 0 for not frozen and 1 for frozen.
  1013. */
  1014. #define HV_FAST_TTRACE_FREEZE 0x93
  1015. /* ttrace_addentry()
  1016. * TRAP: HV_TTRACE_ADDENTRY_TRAP
  1017. * ARG0: tag (16-bits)
  1018. * ARG1: data word 0
  1019. * ARG2: data word 1
  1020. * ARG3: data word 2
  1021. * ARG4: data word 3
  1022. * RET0: status
  1023. * ERRORS: EINVAL No trap trace buffer currently defined
  1024. *
  1025. * Add an entry to the trap trace buffer. Upon return only ARG0/RET0
  1026. * is modified - none of the other registers holding arguments are
  1027. * volatile across this hypervisor service.
  1028. */
  1029. /* Core dump services.
  1030. *
  1031. * Since the hypervisor viraulizes and thus obscures a lot of the
  1032. * physical machine layout and state, traditional OS crash dumps can
  1033. * be difficult to diagnose especially when the problem is a
  1034. * configuration error of some sort.
  1035. *
  1036. * The dump services provide an opaque buffer into which the
  1037. * hypervisor can place it's internal state in order to assist in
  1038. * debugging such situations. The contents are opaque and extremely
  1039. * platform and hypervisor implementation specific. The guest, during
  1040. * a core dump, requests that the hypervisor update any information in
  1041. * the dump buffer in preparation to being dumped as part of the
  1042. * domain's memory image.
  1043. */
  1044. /* dump_buf_update()
  1045. * TRAP: HV_FAST_TRAP
  1046. * FUNCTION: HV_FAST_DUMP_BUF_UPDATE
  1047. * ARG0: real address
  1048. * ARG1: size
  1049. * RET0: status
  1050. * RET1: required size of dump buffer
  1051. * ERRORS: ENORADDR Invalid real address
  1052. * EBADALIGN Real address is not aligned on a 64-byte
  1053. * boundary
  1054. * EINVAL Size is non-zero but less than minimum size
  1055. * required
  1056. * ENOTSUPPORTED Operation not supported on current logical
  1057. * domain
  1058. *
  1059. * Declare a domain dump buffer to the hypervisor. The real address
  1060. * provided for the domain dump buffer must be 64-byte aligned. The
  1061. * size specifies the size of the dump buffer and may be larger than
  1062. * the minimum size specified in the machine description. The
  1063. * hypervisor will fill the dump buffer with opaque data.
  1064. *
  1065. * Note: A guest may elect to include dump buffer contents as part of a crash
  1066. * dump to assist with debugging. This function may be called any number
  1067. * of times so that a guest may relocate a dump buffer, or create
  1068. * "snapshots" of any dump-buffer information. Each call to
  1069. * dump_buf_update() atomically declares the new dump buffer to the
  1070. * hypervisor.
  1071. *
  1072. * A specified size of 0 unconfigures the dump buffer. If the real
  1073. * address is illegal or badly aligned, then any currently active dump
  1074. * buffer is disabled and an error is returned.
  1075. *
  1076. * In the event that the call fails with EINVAL, RET1 contains the
  1077. * minimum size requires by the hypervisor for a valid dump buffer.
  1078. */
  1079. #define HV_FAST_DUMP_BUF_UPDATE 0x94
  1080. /* dump_buf_info()
  1081. * TRAP: HV_FAST_TRAP
  1082. * FUNCTION: HV_FAST_DUMP_BUF_INFO
  1083. * RET0: status
  1084. * RET1: real address of current dump buffer
  1085. * RET2: size of current dump buffer
  1086. * ERRORS: No errors defined.
  1087. *
  1088. * Return the currently configures dump buffer description. A
  1089. * returned size of 0 bytes indicates an undefined dump buffer. In
  1090. * this case the return address in RET1 is undefined.
  1091. */
  1092. #define HV_FAST_DUMP_BUF_INFO 0x95
  1093. /* Device interrupt services.
  1094. *
  1095. * Device interrupts are allocated to system bus bridges by the hypervisor,
  1096. * and described to OBP in the machine description. OBP then describes
  1097. * these interrupts to the OS via properties in the device tree.
  1098. *
  1099. * Terminology:
  1100. *
  1101. * cpuid Unique opaque value which represents a target cpu.
  1102. *
  1103. * devhandle Device handle. It uniquely identifies a device, and
  1104. * consistes of the lower 28-bits of the hi-cell of the
  1105. * first entry of the device's "reg" property in the
  1106. * OBP device tree.
  1107. *
  1108. * devino Device interrupt number. Specifies the relative
  1109. * interrupt number within the device. The unique
  1110. * combination of devhandle and devino are used to
  1111. * identify a specific device interrupt.
  1112. *
  1113. * Note: The devino value is the same as the values in the
  1114. * "interrupts" property or "interrupt-map" property
  1115. * in the OBP device tree for that device.
  1116. *
  1117. * sysino System interrupt number. A 64-bit unsigned interger
  1118. * representing a unique interrupt within a virtual
  1119. * machine.
  1120. *
  1121. * intr_state A flag representing the interrupt state for a given
  1122. * sysino. The state values are defined below.
  1123. *
  1124. * intr_enabled A flag representing the 'enabled' state for a given
  1125. * sysino. The enable values are defined below.
  1126. */
  1127. #define HV_INTR_STATE_IDLE 0 /* Nothing pending */
  1128. #define HV_INTR_STATE_RECEIVED 1 /* Interrupt received by hardware */
  1129. #define HV_INTR_STATE_DELIVERED 2 /* Interrupt delivered to queue */
  1130. #define HV_INTR_DISABLED 0 /* sysino not enabled */
  1131. #define HV_INTR_ENABLED 1 /* sysino enabled */
  1132. /* intr_devino_to_sysino()
  1133. * TRAP: HV_FAST_TRAP
  1134. * FUNCTION: HV_FAST_INTR_DEVINO2SYSINO
  1135. * ARG0: devhandle
  1136. * ARG1: devino
  1137. * RET0: status
  1138. * RET1: sysino
  1139. * ERRORS: EINVAL Invalid devhandle/devino
  1140. *
  1141. * Converts a device specific interrupt number of the given
  1142. * devhandle/devino into a system specific ino (sysino).
  1143. */
  1144. #define HV_FAST_INTR_DEVINO2SYSINO 0xa0
  1145. #ifndef __ASSEMBLY__
  1146. extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle,
  1147. unsigned long devino);
  1148. #endif
  1149. /* intr_getenabled()
  1150. * TRAP: HV_FAST_TRAP
  1151. * FUNCTION: HV_FAST_INTR_GETENABLED
  1152. * ARG0: sysino
  1153. * RET0: status
  1154. * RET1: intr_enabled (HV_INTR_{DISABLED,ENABLED})
  1155. * ERRORS: EINVAL Invalid sysino
  1156. *
  1157. * Returns interrupt enabled state in RET1 for the interrupt defined
  1158. * by the given sysino.
  1159. */
  1160. #define HV_FAST_INTR_GETENABLED 0xa1
  1161. #ifndef __ASSEMBLY__
  1162. extern unsigned long sun4v_intr_getenabled(unsigned long sysino);
  1163. #endif
  1164. /* intr_setenabled()
  1165. * TRAP: HV_FAST_TRAP
  1166. * FUNCTION: HV_FAST_INTR_SETENABLED
  1167. * ARG0: sysino
  1168. * ARG1: intr_enabled (HV_INTR_{DISABLED,ENABLED})
  1169. * RET0: status
  1170. * ERRORS: EINVAL Invalid sysino or intr_enabled value
  1171. *
  1172. * Set the 'enabled' state of the interrupt sysino.
  1173. */
  1174. #define HV_FAST_INTR_SETENABLED 0xa2
  1175. #ifndef __ASSEMBLY__
  1176. extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long intr_enabled);
  1177. #endif
  1178. /* intr_getstate()
  1179. * TRAP: HV_FAST_TRAP
  1180. * FUNCTION: HV_FAST_INTR_GETSTATE
  1181. * ARG0: sysino
  1182. * RET0: status
  1183. * RET1: intr_state (HV_INTR_STATE_*)
  1184. * ERRORS: EINVAL Invalid sysino
  1185. *
  1186. * Returns current state of the interrupt defined by the given sysino.
  1187. */
  1188. #define HV_FAST_INTR_GETSTATE 0xa3
  1189. #ifndef __ASSEMBLY__
  1190. extern unsigned long sun4v_intr_getstate(unsigned long sysino);
  1191. #endif
  1192. /* intr_setstate()
  1193. * TRAP: HV_FAST_TRAP
  1194. * FUNCTION: HV_FAST_INTR_SETSTATE
  1195. * ARG0: sysino
  1196. * ARG1: intr_state (HV_INTR_STATE_*)
  1197. * RET0: status
  1198. * ERRORS: EINVAL Invalid sysino or intr_state value
  1199. *
  1200. * Sets the current state of the interrupt described by the given sysino
  1201. * value.
  1202. *
  1203. * Note: Setting the state to HV_INTR_STATE_IDLE clears any pending
  1204. * interrupt for sysino.
  1205. */
  1206. #define HV_FAST_INTR_SETSTATE 0xa4
  1207. #ifndef __ASSEMBLY__
  1208. extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state);
  1209. #endif
  1210. /* intr_gettarget()
  1211. * TRAP: HV_FAST_TRAP
  1212. * FUNCTION: HV_FAST_INTR_GETTARGET
  1213. * ARG0: sysino
  1214. * RET0: status
  1215. * RET1: cpuid
  1216. * ERRORS: EINVAL Invalid sysino
  1217. *
  1218. * Returns CPU that is the current target of the interrupt defined by
  1219. * the given sysino. The CPU value returned is undefined if the target
  1220. * has not been set via intr_settarget().
  1221. */
  1222. #define HV_FAST_INTR_GETTARGET 0xa5
  1223. #ifndef __ASSEMBLY__
  1224. extern unsigned long sun4v_intr_gettarget(unsigned long sysino);
  1225. #endif
  1226. /* intr_settarget()
  1227. * TRAP: HV_FAST_TRAP
  1228. * FUNCTION: HV_FAST_INTR_SETTARGET
  1229. * ARG0: sysino
  1230. * ARG1: cpuid
  1231. * RET0: status
  1232. * ERRORS: EINVAL Invalid sysino
  1233. * ENOCPU Invalid cpuid
  1234. *
  1235. * Set the target CPU for the interrupt defined by the given sysino.
  1236. */
  1237. #define HV_FAST_INTR_SETTARGET 0xa6
  1238. #ifndef __ASSEMBLY__
  1239. extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid);
  1240. #endif
  1241. /* PCI IO services.
  1242. *
  1243. * See the terminology descriptions in the device interrupt services
  1244. * section above as those apply here too. Here are terminology
  1245. * definitions specific to these PCI IO services:
  1246. *
  1247. * tsbnum TSB number. Indentifies which io-tsb is used.
  1248. * For this version of the specification, tsbnum
  1249. * must be zero.
  1250. *
  1251. * tsbindex TSB index. Identifies which entry in the TSB
  1252. * is used. The first entry is zero.
  1253. *
  1254. * tsbid A 64-bit aligned data structure which contains
  1255. * a tsbnum and a tsbindex. Bits 63:32 contain the
  1256. * tsbnum and bits 31:00 contain the tsbindex.
  1257. *
  1258. * Use the HV_PCI_TSBID() macro to construct such
  1259. * values.
  1260. *
  1261. * io_attributes IO attributes for IOMMU mappings. One of more
  1262. * of the attritbute bits are stores in a 64-bit
  1263. * value. The values are defined below.
  1264. *
  1265. * r_addr 64-bit real address
  1266. *
  1267. * pci_device PCI device address. A PCI device address identifies
  1268. * a specific device on a specific PCI bus segment.
  1269. * A PCI device address ia a 32-bit unsigned integer
  1270. * with the following format:
  1271. *
  1272. * 00000000.bbbbbbbb.dddddfff.00000000
  1273. *
  1274. * Use the HV_PCI_DEVICE_BUILD() macro to construct
  1275. * such values.
  1276. *
  1277. * pci_config_offset
  1278. * PCI configureation space offset. For conventional
  1279. * PCI a value between 0 and 255. For extended
  1280. * configuration space, a value between 0 and 4095.
  1281. *
  1282. * Note: For PCI configuration space accesses, the offset
  1283. * must be aligned to the access size.
  1284. *
  1285. * error_flag A return value which specifies if the action succeeded
  1286. * or failed. 0 means no error, non-0 means some error
  1287. * occurred while performing the service.
  1288. *
  1289. * io_sync_direction
  1290. * Direction definition for pci_dma_sync(), defined
  1291. * below in HV_PCI_SYNC_*.
  1292. *
  1293. * io_page_list A list of io_page_addresses, an io_page_address is
  1294. * a real address.
  1295. *
  1296. * io_page_list_p A pointer to an io_page_list.
  1297. *
  1298. * "size based byte swap" - Some functions do size based byte swapping
  1299. * which allows sw to access pointers and
  1300. * counters in native form when the processor
  1301. * operates in a different endianness than the
  1302. * IO bus. Size-based byte swapping converts a
  1303. * multi-byte field between big-endian and
  1304. * little-endian format.
  1305. */
  1306. #define HV_PCI_MAP_ATTR_READ 0x01
  1307. #define HV_PCI_MAP_ATTR_WRITE 0x02
  1308. #define HV_PCI_DEVICE_BUILD(b,d,f) \
  1309. ((((b) & 0xff) << 16) | \
  1310. (((d) & 0x1f) << 11) | \
  1311. (((f) & 0x07) << 8))
  1312. #define HV_PCI_TSBID(__tsb_num, __tsb_index) \
  1313. ((((u64)(__tsb_num)) << 32UL) | ((u64)(__tsb_index)))
  1314. #define HV_PCI_SYNC_FOR_DEVICE 0x01
  1315. #define HV_PCI_SYNC_FOR_CPU 0x02
  1316. /* pci_iommu_map()
  1317. * TRAP: HV_FAST_TRAP
  1318. * FUNCTION: HV_FAST_PCI_IOMMU_MAP
  1319. * ARG0: devhandle
  1320. * ARG1: tsbid
  1321. * ARG2: #ttes
  1322. * ARG3: io_attributes
  1323. * ARG4: io_page_list_p
  1324. * RET0: status
  1325. * RET1: #ttes mapped
  1326. * ERRORS: EINVAL Invalid devhandle/tsbnum/tsbindex/io_attributes
  1327. * EBADALIGN Improperly aligned real address
  1328. * ENORADDR Invalid real address
  1329. *
  1330. * Create IOMMU mappings in the sun4v device defined by the given
  1331. * devhandle. The mappings are created in the TSB defined by the
  1332. * tsbnum component of the given tsbid. The first mapping is created
  1333. * in the TSB i ndex defined by the tsbindex component of the given tsbid.
  1334. * The call creates up to #ttes mappings, the first one at tsbnum, tsbindex,
  1335. * the second at tsbnum, tsbindex + 1, etc.
  1336. *
  1337. * All mappings are created with the attributes defined by the io_attributes
  1338. * argument. The page mapping addresses are described in the io_page_list
  1339. * defined by the given io_page_list_p, which is a pointer to the io_page_list.
  1340. * The first entry in the io_page_list is the address for the first iotte, the
  1341. * 2nd for the 2nd iotte, and so on.
  1342. *
  1343. * Each io_page_address in the io_page_list must be appropriately aligned.
  1344. * #ttes must be greater than zero. For this version of the spec, the tsbnum
  1345. * component of the given tsbid must be zero.
  1346. *
  1347. * Returns the actual number of mappings creates, which may be less than
  1348. * or equal to the argument #ttes. If the function returns a value which
  1349. * is less than the #ttes, the caller may continus to call the function with
  1350. * an updated tsbid, #ttes, io_page_list_p arguments until all pages are
  1351. * mapped.
  1352. *
  1353. * Note: This function does not imply an iotte cache flush. The guest must
  1354. * demap an entry before re-mapping it.
  1355. */
  1356. #define HV_FAST_PCI_IOMMU_MAP 0xb0
  1357. /* pci_iommu_demap()
  1358. * TRAP: HV_FAST_TRAP
  1359. * FUNCTION: HV_FAST_PCI_IOMMU_DEMAP
  1360. * ARG0: devhandle
  1361. * ARG1: tsbid
  1362. * ARG2: #ttes
  1363. * RET0: status
  1364. * RET1: #ttes demapped
  1365. * ERRORS: EINVAL Invalid devhandle/tsbnum/tsbindex
  1366. *
  1367. * Demap and flush IOMMU mappings in the device defined by the given
  1368. * devhandle. Demaps up to #ttes entries in the TSB defined by the tsbnum
  1369. * component of the given tsbid, starting at the TSB index defined by the
  1370. * tsbindex component of the given tsbid.
  1371. *
  1372. * For this version of the spec, the tsbnum of the given tsbid must be zero.
  1373. * #ttes must be greater than zero.
  1374. *
  1375. * Returns the actual number of ttes demapped, which may be less than or equal
  1376. * to the argument #ttes. If #ttes demapped is less than #ttes, the caller
  1377. * may continue to call this function with updated tsbid and #ttes arguments
  1378. * until all pages are demapped.
  1379. *
  1380. * Note: Entries do not have to be mapped to be demapped. A demap of an
  1381. * unmapped page will flush the entry from the tte cache.
  1382. */
  1383. #define HV_FAST_PCI_IOMMU_DEMAP 0xb1
  1384. /* pci_iommu_getmap()
  1385. * TRAP: HV_FAST_TRAP
  1386. * FUNCTION: HV_FAST_PCI_IOMMU_GETMAP
  1387. * ARG0: devhandle
  1388. * ARG1: tsbid
  1389. * RET0: status
  1390. * RET1: io_attributes
  1391. * RET2: real address
  1392. * ERRORS: EINVAL Invalid devhandle/tsbnum/tsbindex
  1393. * ENOMAP Mapping is not valid, no translation exists
  1394. *
  1395. * Read and return the mapping in the device described by the given devhandle
  1396. * and tsbid. If successful, the io_attributes shall be returned in RET1
  1397. * and the page address of the mapping shall be returned in RET2.
  1398. *
  1399. * For this version of the spec, the tsbnum component of the given tsbid
  1400. * must be zero.
  1401. */
  1402. #define HV_FAST_PCI_IOMMU_GETMAP 0xb2
  1403. /* pci_iommu_getbypass()
  1404. * TRAP: HV_FAST_TRAP
  1405. * FUNCTION: HV_FAST_PCI_IOMMU_GETBYPASS
  1406. * ARG0: devhandle
  1407. * ARG1: real address
  1408. * ARG2: io_attributes
  1409. * RET0: status
  1410. * RET1: io_addr
  1411. * ERRORS: EINVAL Invalid devhandle/io_attributes
  1412. * ENORADDR Invalid real address
  1413. * ENOTSUPPORTED Function not supported in this implementation.
  1414. *
  1415. * Create a "special" mapping in the device described by the given devhandle,
  1416. * for the given real address and attributes. Return the IO address in RET1
  1417. * if successful.
  1418. */
  1419. #define HV_FAST_PCI_IOMMU_GETBYPASS 0xb3
  1420. /* pci_config_get()
  1421. * TRAP: HV_FAST_TRAP
  1422. * FUNCTION: HV_FAST_PCI_CONFIG_GET
  1423. * ARG0: devhandle
  1424. * ARG1: pci_device
  1425. * ARG2: pci_config_offset
  1426. * ARG3: size
  1427. * RET0: status
  1428. * RET1: error_flag
  1429. * RET2: data
  1430. * ERRORS: EINVAL Invalid devhandle/pci_device/offset/size
  1431. * EBADALIGN pci_config_offset not size aligned
  1432. * ENOACCESS Access to this offset is not permitted
  1433. *
  1434. * Read PCI configuration space for the adapter described by the given
  1435. * devhandle. Read size (1, 2, or 4) bytes of data from the given
  1436. * pci_device, at pci_config_offset from the beginning of the device's
  1437. * configuration space. If there was no error, RET1 is set to zero and
  1438. * RET2 is set to the data read. Insignificant bits in RET2 are not
  1439. * guarenteed to have any specific value and therefore must be ignored.
  1440. *
  1441. * The data returned in RET2 is size based byte swapped.
  1442. *
  1443. * If an error occurs during the read, set RET1 to a non-zero value. The
  1444. * given pci_config_offset must be 'size' aligned.
  1445. */
  1446. #define HV_FAST_PCI_CONFIG_GET 0xb4
  1447. /* pci_config_put()
  1448. * TRAP: HV_FAST_TRAP
  1449. * FUNCTION: HV_FAST_PCI_CONFIG_PUT
  1450. * ARG0: devhandle
  1451. * ARG1: pci_device
  1452. * ARG2: pci_config_offset
  1453. * ARG3: size
  1454. * ARG4: data
  1455. * RET0: status
  1456. * RET1: error_flag
  1457. * ERRORS: EINVAL Invalid devhandle/pci_device/offset/size
  1458. * EBADALIGN pci_config_offset not size aligned
  1459. * ENOACCESS Access to this offset is not permitted
  1460. *
  1461. * Write PCI configuration space for the adapter described by the given
  1462. * devhandle. Write size (1, 2, or 4) bytes of data in a single operation,
  1463. * at pci_config_offset from the beginning of the device's configuration
  1464. * space. The data argument contains the data to be written to configuration
  1465. * space. Prior to writing, the data is size based byte swapped.
  1466. *
  1467. * If an error occurs during the write access, do not generate an error
  1468. * report, do set RET1 to a non-zero value. Otherwise RET1 is zero.
  1469. * The given pci_config_offset must be 'size' aligned.
  1470. *
  1471. * This function is permitted to read from offset zero in the configuration
  1472. * space described by the given pci_device if necessary to ensure that the
  1473. * write access to config space completes.
  1474. */
  1475. #define HV_FAST_PCI_CONFIG_PUT 0xb5
  1476. /* pci_peek()
  1477. * TRAP: HV_FAST_TRAP
  1478. * FUNCTION: HV_FAST_PCI_PEEK
  1479. * ARG0: devhandle
  1480. * ARG1: real address
  1481. * ARG2: size
  1482. * RET0: status
  1483. * RET1: error_flag
  1484. * RET2: data
  1485. * ERRORS: EINVAL Invalid devhandle or size
  1486. * EBADALIGN Improperly aligned real address
  1487. * ENORADDR Bad real address
  1488. * ENOACCESS Guest access prohibited
  1489. *
  1490. * Attempt to read the IO address given by the given devhandle, real address,
  1491. * and size. Size must be 1, 2, 4, or 8. The read is performed as a single
  1492. * access operation using the given size. If an error occurs when reading
  1493. * from the given location, do not generate an error report, but return a
  1494. * non-zero value in RET1. If the read was successful, return zero in RET1
  1495. * and return the actual data read in RET2. The data returned is size based
  1496. * byte swapped.
  1497. *
  1498. * Non-significant bits in RET2 are not guarenteed to have any specific value
  1499. * and therefore must be ignored. If RET1 is returned as non-zero, the data
  1500. * value is not guarenteed to have any specific value and should be ignored.
  1501. *
  1502. * The caller must have permission to read from the given devhandle, real
  1503. * address, which must be an IO address. The argument real address must be a
  1504. * size aligned address.
  1505. *
  1506. * The hypervisor implementation of this function must block access to any
  1507. * IO address that the guest does not have explicit permission to access.
  1508. */
  1509. #define HV_FAST_PCI_PEEK 0xb6
  1510. /* pci_poke()
  1511. * TRAP: HV_FAST_TRAP
  1512. * FUNCTION: HV_FAST_PCI_POKE
  1513. * ARG0: devhandle
  1514. * ARG1: real address
  1515. * ARG2: size
  1516. * ARG3: data
  1517. * ARG4: pci_device
  1518. * RET0: status
  1519. * RET1: error_flag
  1520. * ERRORS: EINVAL Invalid devhandle, size, or pci_device
  1521. * EBADALIGN Improperly aligned real address
  1522. * ENORADDR Bad real address
  1523. * ENOACCESS Guest access prohibited
  1524. * ENOTSUPPORTED Function is not supported by implementation
  1525. *
  1526. * Attempt to write data to the IO address given by the given devhandle,
  1527. * real address, and size. Size must be 1, 2, 4, or 8. The write is
  1528. * performed as a single access operation using the given size. Prior to
  1529. * writing the data is size based swapped.
  1530. *
  1531. * If an error occurs when writing to the given location, do not generate an
  1532. * error report, but return a non-zero value in RET1. If the write was
  1533. * successful, return zero in RET1.
  1534. *
  1535. * pci_device describes the configuration address of the device being
  1536. * written to. The implementation may safely read from offset 0 with
  1537. * the configuration space of the device described by devhandle and
  1538. * pci_device in order to guarantee that the write portion of the operation
  1539. * completes
  1540. *
  1541. * Any error that occurs due to the read shall be reported using the normal
  1542. * error reporting mechanisms .. the read error is not suppressed.
  1543. *
  1544. * The caller must have permission to write to the given devhandle, real
  1545. * address, which must be an IO address. The argument real address must be a
  1546. * size aligned address. The caller must have permission to read from
  1547. * the given devhandle, pci_device cofiguration space offset 0.
  1548. *
  1549. * The hypervisor implementation of this function must block access to any
  1550. * IO address that the guest does not have explicit permission to access.
  1551. */
  1552. #define HV_FAST_PCI_POKE 0xb7
  1553. /* pci_dma_sync()
  1554. * TRAP: HV_FAST_TRAP
  1555. * FUNCTION: HV_FAST_PCI_DMA_SYNC
  1556. * ARG0: devhandle
  1557. * ARG1: real address
  1558. * ARG2: size
  1559. * ARG3: io_sync_direction
  1560. * RET0: status
  1561. * RET1: #synced
  1562. * ERRORS: EINVAL Invalid devhandle or io_sync_direction
  1563. * ENORADDR Bad real address
  1564. *
  1565. * Synchronize a memory region described by the given real address and size,
  1566. * for the device defined by the given devhandle using the direction(s)
  1567. * defined by the given io_sync_direction. The argument size is the size of
  1568. * the memory region in bytes.
  1569. *
  1570. * Return the actual number of bytes synchronized in the return value #synced,
  1571. * which may be less than or equal to the argument size. If the return
  1572. * value #synced is less than size, the caller must continue to call this
  1573. * function with updated real address and size arguments until the entire
  1574. * memory region is synchronized.
  1575. */
  1576. #define HV_FAST_PCI_DMA_SYNC 0xb8
  1577. /* PCI MSI services. */
  1578. #define HV_MSITYPE_MSI32 0x00
  1579. #define HV_MSITYPE_MSI64 0x01
  1580. #define HV_MSIQSTATE_IDLE 0x00
  1581. #define HV_MSIQSTATE_ERROR 0x01
  1582. #define HV_MSIQ_INVALID 0x00
  1583. #define HV_MSIQ_VALID 0x01
  1584. #define HV_MSISTATE_IDLE 0x00
  1585. #define HV_MSISTATE_DELIVERED 0x01
  1586. #define HV_MSIVALID_INVALID 0x00
  1587. #define HV_MSIVALID_VALID 0x01
  1588. #define HV_PCIE_MSGTYPE_PME_MSG 0x18
  1589. #define HV_PCIE_MSGTYPE_PME_ACK_MSG 0x1b
  1590. #define HV_PCIE_MSGTYPE_CORR_MSG 0x30
  1591. #define HV_PCIE_MSGTYPE_NONFATAL_MSG 0x31
  1592. #define HV_PCIE_MSGTYPE_FATAL_MSG 0x33
  1593. #define HV_MSG_INVALID 0x00
  1594. #define HV_MSG_VALID 0x01
  1595. /* pci_msiq_conf()
  1596. * TRAP: HV_FAST_TRAP
  1597. * FUNCTION: HV_FAST_PCI_MSIQ_CONF
  1598. * ARG0: devhandle
  1599. * ARG1: msiqid
  1600. * ARG2: real address
  1601. * ARG3: number of entries
  1602. * RET0: status
  1603. * ERRORS: EINVAL Invalid devhandle, msiqid or nentries
  1604. * EBADALIGN Improperly aligned real address
  1605. * ENORADDR Bad real address
  1606. *
  1607. * Configure the MSI queue given by the devhandle and msiqid arguments,
  1608. * and to be placed at the given real address and be of the given
  1609. * number of entries. The real address must be aligned exactly to match
  1610. * the queue size. Each queue entry is 64-bytes long, so f.e. a 32 entry
  1611. * queue must be aligned on a 2048 byte real address boundary. The MSI-EQ
  1612. * Head and Tail are initialized so that the MSI-EQ is 'empty'.
  1613. *
  1614. * Implementation Note: Certain implementations have fixed sized queues. In
  1615. * that case, number of entries must contain the correct
  1616. * value.
  1617. */
  1618. #define HV_FAST_PCI_MSIQ_CONF 0xc0
  1619. /* pci_msiq_info()
  1620. * TRAP: HV_FAST_TRAP
  1621. * FUNCTION: HV_FAST_PCI_MSIQ_INFO
  1622. * ARG0: devhandle
  1623. * ARG1: msiqid
  1624. * RET0: status
  1625. * RET1: real address
  1626. * RET2: number of entries
  1627. * ERRORS: EINVAL Invalid devhandle or msiqid
  1628. *
  1629. * Return the configuration information for the MSI queue described
  1630. * by the given devhandle and msiqid. The base address of the queue
  1631. * is returned in ARG1 and the number of entries is returned in ARG2.
  1632. * If the queue is unconfigured, the real address is undefined and the
  1633. * number of entries will be returned as zero.
  1634. */
  1635. #define HV_FAST_PCI_MSIQ_INFO 0xc1
  1636. /* pci_msiq_getvalid()
  1637. * TRAP: HV_FAST_TRAP
  1638. * FUNCTION: HV_FAST_PCI_MSIQ_GETVALID
  1639. * ARG0: devhandle
  1640. * ARG1: msiqid
  1641. * RET0: status
  1642. * RET1: msiqvalid (HV_MSIQ_VALID or HV_MSIQ_INVALID)
  1643. * ERRORS: EINVAL Invalid devhandle or msiqid
  1644. *
  1645. * Get the valid state of the MSI-EQ described by the given devhandle and
  1646. * msiqid.
  1647. */
  1648. #define HV_FAST_PCI_MSIQ_GETVALID 0xc2
  1649. /* pci_msiq_setvalid()
  1650. * TRAP: HV_FAST_TRAP
  1651. * FUNCTION: HV_FAST_PCI_MSIQ_SETVALID
  1652. * ARG0: devhandle
  1653. * ARG1: msiqid
  1654. * ARG2: msiqvalid (HV_MSIQ_VALID or HV_MSIQ_INVALID)
  1655. * RET0: status
  1656. * ERRORS: EINVAL Invalid devhandle or msiqid or msiqvalid
  1657. * value or MSI EQ is uninitialized
  1658. *
  1659. * Set the valid state of the MSI-EQ described by the given devhandle and
  1660. * msiqid to the given msiqvalid.
  1661. */
  1662. #define HV_FAST_PCI_MSIQ_SETVALID 0xc3
  1663. /* pci_msiq_getstate()
  1664. * TRAP: HV_FAST_TRAP
  1665. * FUNCTION: HV_FAST_PCI_MSIQ_GETSTATE
  1666. * ARG0: devhandle
  1667. * ARG1: msiqid
  1668. * RET0: status
  1669. * RET1: msiqstate (HV_MSIQSTATE_IDLE or HV_MSIQSTATE_ERROR)
  1670. * ERRORS: EINVAL Invalid devhandle or msiqid
  1671. *
  1672. * Get the state of the MSI-EQ described by the given devhandle and
  1673. * msiqid.
  1674. */
  1675. #define HV_FAST_PCI_MSIQ_GETSTATE 0xc4
  1676. /* pci_msiq_getvalid()
  1677. * TRAP: HV_FAST_TRAP
  1678. * FUNCTION: HV_FAST_PCI_MSIQ_GETVALID
  1679. * ARG0: devhandle
  1680. * ARG1: msiqid
  1681. * ARG2: msiqstate (HV_MSIQSTATE_IDLE or HV_MSIQSTATE_ERROR)
  1682. * RET0: status
  1683. * ERRORS: EINVAL Invalid devhandle or msiqid or msiqstate
  1684. * value or MSI EQ is uninitialized
  1685. *
  1686. * Set the state of the MSI-EQ described by the given devhandle and
  1687. * msiqid to the given msiqvalid.
  1688. */
  1689. #define HV_FAST_PCI_MSIQ_SETSTATE 0xc5
  1690. /* pci_msiq_gethead()
  1691. * TRAP: HV_FAST_TRAP
  1692. * FUNCTION: HV_FAST_PCI_MSIQ_GETHEAD
  1693. * ARG0: devhandle
  1694. * ARG1: msiqid
  1695. * RET0: status
  1696. * RET1: msiqhead
  1697. * ERRORS: EINVAL Invalid devhandle or msiqid
  1698. *
  1699. * Get the current MSI EQ queue head for the MSI-EQ described by the
  1700. * given devhandle and msiqid.
  1701. */
  1702. #define HV_FAST_PCI_MSIQ_GETHEAD 0xc6
  1703. /* pci_msiq_sethead()
  1704. * TRAP: HV_FAST_TRAP
  1705. * FUNCTION: HV_FAST_PCI_MSIQ_SETHEAD
  1706. * ARG0: devhandle
  1707. * ARG1: msiqid
  1708. * ARG2: msiqhead
  1709. * RET0: status
  1710. * ERRORS: EINVAL Invalid devhandle or msiqid or msiqhead,
  1711. * or MSI EQ is uninitialized
  1712. *
  1713. * Set the current MSI EQ queue head for the MSI-EQ described by the
  1714. * given devhandle and msiqid.
  1715. */
  1716. #define HV_FAST_PCI_MSIQ_SETHEAD 0xc7
  1717. /* pci_msiq_gettail()
  1718. * TRAP: HV_FAST_TRAP
  1719. * FUNCTION: HV_FAST_PCI_MSIQ_GETTAIL
  1720. * ARG0: devhandle
  1721. * ARG1: msiqid
  1722. * RET0: status
  1723. * RET1: msiqtail
  1724. * ERRORS: EINVAL Invalid devhandle or msiqid
  1725. *
  1726. * Get the current MSI EQ queue tail for the MSI-EQ described by the
  1727. * given devhandle and msiqid.
  1728. */
  1729. #define HV_FAST_PCI_MSIQ_GETTAIL 0xc8
  1730. /* pci_msi_getvalid()
  1731. * TRAP: HV_FAST_TRAP
  1732. * FUNCTION: HV_FAST_PCI_MSI_GETVALID
  1733. * ARG0: devhandle
  1734. * ARG1: msinum
  1735. * RET0: status
  1736. * RET1: msivalidstate
  1737. * ERRORS: EINVAL Invalid devhandle or msinum
  1738. *
  1739. * Get the current valid/enabled state for the MSI defined by the
  1740. * given devhandle and msinum.
  1741. */
  1742. #define HV_FAST_PCI_MSI_GETVALID 0xc9
  1743. /* pci_msi_setvalid()
  1744. * TRAP: HV_FAST_TRAP
  1745. * FUNCTION: HV_FAST_PCI_MSI_SETVALID
  1746. * ARG0: devhandle
  1747. * ARG1: msinum
  1748. * ARG2: msivalidstate
  1749. * RET0: status
  1750. * ERRORS: EINVAL Invalid devhandle or msinum or msivalidstate
  1751. *
  1752. * Set the current valid/enabled state for the MSI defined by the
  1753. * given devhandle and msinum.
  1754. */
  1755. #define HV_FAST_PCI_MSI_SETVALID 0xca
  1756. /* pci_msi_getmsiq()
  1757. * TRAP: HV_FAST_TRAP
  1758. * FUNCTION: HV_FAST_PCI_MSI_GETMSIQ
  1759. * ARG0: devhandle
  1760. * ARG1: msinum
  1761. * RET0: status
  1762. * RET1: msiqid
  1763. * ERRORS: EINVAL Invalid devhandle or msinum or MSI is unbound
  1764. *
  1765. * Get the MSI EQ that the MSI defined by the given devhandle and
  1766. * msinum is bound to.
  1767. */
  1768. #define HV_FAST_PCI_MSI_GETMSIQ 0xcb
  1769. /* pci_msi_setmsiq()
  1770. * TRAP: HV_FAST_TRAP
  1771. * FUNCTION: HV_FAST_PCI_MSI_SETMSIQ
  1772. * ARG0: devhandle
  1773. * ARG1: msinum
  1774. * ARG2: msitype
  1775. * ARG3: msiqid
  1776. * RET0: status
  1777. * ERRORS: EINVAL Invalid devhandle or msinum or msiqid
  1778. *
  1779. * Set the MSI EQ that the MSI defined by the given devhandle and
  1780. * msinum is bound to.
  1781. */
  1782. #define HV_FAST_PCI_MSI_SETMSIQ 0xcc
  1783. /* pci_msi_getstate()
  1784. * TRAP: HV_FAST_TRAP
  1785. * FUNCTION: HV_FAST_PCI_MSI_GETSTATE
  1786. * ARG0: devhandle
  1787. * ARG1: msinum
  1788. * RET0: status
  1789. * RET1: msistate
  1790. * ERRORS: EINVAL Invalid devhandle or msinum
  1791. *
  1792. * Get the state of the MSI defined by the given devhandle and msinum.
  1793. * If not initialized, return HV_MSISTATE_IDLE.
  1794. */
  1795. #define HV_FAST_PCI_MSI_GETSTATE 0xcd
  1796. /* pci_msi_setstate()
  1797. * TRAP: HV_FAST_TRAP
  1798. * FUNCTION: HV_FAST_PCI_MSI_SETSTATE
  1799. * ARG0: devhandle
  1800. * ARG1: msinum
  1801. * ARG2: msistate
  1802. * RET0: status
  1803. * ERRORS: EINVAL Invalid devhandle or msinum or msistate
  1804. *
  1805. * Set the state of the MSI defined by the given devhandle and msinum.
  1806. */
  1807. #define HV_FAST_PCI_MSI_SETSTATE 0xce
  1808. /* pci_msg_getmsiq()
  1809. * TRAP: HV_FAST_TRAP
  1810. * FUNCTION: HV_FAST_PCI_MSG_GETMSIQ
  1811. * ARG0: devhandle
  1812. * ARG1: msgtype
  1813. * RET0: status
  1814. * RET1: msiqid
  1815. * ERRORS: EINVAL Invalid devhandle or msgtype
  1816. *
  1817. * Get the MSI EQ of the MSG defined by the given devhandle and msgtype.
  1818. */
  1819. #define HV_FAST_PCI_MSG_GETMSIQ 0xd0
  1820. /* pci_msg_setmsiq()
  1821. * TRAP: HV_FAST_TRAP
  1822. * FUNCTION: HV_FAST_PCI_MSG_SETMSIQ
  1823. * ARG0: devhandle
  1824. * ARG1: msgtype
  1825. * ARG2: msiqid
  1826. * RET0: status
  1827. * ERRORS: EINVAL Invalid devhandle, msgtype, or msiqid
  1828. *
  1829. * Set the MSI EQ of the MSG defined by the given devhandle and msgtype.
  1830. */
  1831. #define HV_FAST_PCI_MSG_SETMSIQ 0xd1
  1832. /* pci_msg_getvalid()
  1833. * TRAP: HV_FAST_TRAP
  1834. * FUNCTION: HV_FAST_PCI_MSG_GETVALID
  1835. * ARG0: devhandle
  1836. * ARG1: msgtype
  1837. * RET0: status
  1838. * RET1: msgvalidstate
  1839. * ERRORS: EINVAL Invalid devhandle or msgtype
  1840. *
  1841. * Get the valid/enabled state of the MSG defined by the given
  1842. * devhandle and msgtype.
  1843. */
  1844. #define HV_FAST_PCI_MSG_GETVALID 0xd2
  1845. /* pci_msg_setvalid()
  1846. * TRAP: HV_FAST_TRAP
  1847. * FUNCTION: HV_FAST_PCI_MSG_SETVALID
  1848. * ARG0: devhandle
  1849. * ARG1: msgtype
  1850. * ARG2: msgvalidstate
  1851. * RET0: status
  1852. * ERRORS: EINVAL Invalid devhandle or msgtype or msgvalidstate
  1853. *
  1854. * Set the valid/enabled state of the MSG defined by the given
  1855. * devhandle and msgtype.
  1856. */
  1857. #define HV_FAST_PCI_MSG_SETVALID 0xd3
  1858. /* Performance counter services. */
  1859. #define HV_PERF_JBUS_PERF_CTRL_REG 0x00
  1860. #define HV_PERF_JBUS_PERF_CNT_REG 0x01
  1861. #define HV_PERF_DRAM_PERF_CTRL_REG_0 0x02
  1862. #define HV_PERF_DRAM_PERF_CNT_REG_0 0x03
  1863. #define HV_PERF_DRAM_PERF_CTRL_REG_1 0x04
  1864. #define HV_PERF_DRAM_PERF_CNT_REG_1 0x05
  1865. #define HV_PERF_DRAM_PERF_CTRL_REG_2 0x06
  1866. #define HV_PERF_DRAM_PERF_CNT_REG_2 0x07
  1867. #define HV_PERF_DRAM_PERF_CTRL_REG_3 0x08
  1868. #define HV_PERF_DRAM_PERF_CNT_REG_3 0x09
  1869. /* get_perfreg()
  1870. * TRAP: HV_FAST_TRAP
  1871. * FUNCTION: HV_FAST_GET_PERFREG
  1872. * ARG0: performance reg number
  1873. * RET0: status
  1874. * RET1: performance reg value
  1875. * ERRORS: EINVAL Invalid performance register number
  1876. * ENOACCESS No access allowed to performance counters
  1877. *
  1878. * Read the value of the given DRAM/JBUS performance counter/control register.
  1879. */
  1880. #define HV_FAST_GET_PERFREG 0x100
  1881. /* set_perfreg()
  1882. * TRAP: HV_FAST_TRAP
  1883. * FUNCTION: HV_FAST_SET_PERFREG
  1884. * ARG0: performance reg number
  1885. * ARG1: performance reg value
  1886. * RET0: status
  1887. * ERRORS: EINVAL Invalid performance register number
  1888. * ENOACCESS No access allowed to performance counters
  1889. *
  1890. * Write the given performance reg value to the given DRAM/JBUS
  1891. * performance counter/control register.
  1892. */
  1893. #define HV_FAST_SET_PERFREG 0x101
  1894. /* MMU statistics services.
  1895. *
  1896. * The hypervisor maintains MMU statistics and privileged code provides
  1897. * a buffer where these statistics can be collected. It is continually
  1898. * updated once configured. The layout is as follows:
  1899. */
  1900. #ifndef __ASSEMBLY__
  1901. struct hv_mmu_statistics {
  1902. unsigned long immu_tsb_hits_ctx0_8k_tte;
  1903. unsigned long immu_tsb_ticks_ctx0_8k_tte;
  1904. unsigned long immu_tsb_hits_ctx0_64k_tte;
  1905. unsigned long immu_tsb_ticks_ctx0_64k_tte;
  1906. unsigned long __reserved1[2];
  1907. unsigned long immu_tsb_hits_ctx0_4mb_tte;
  1908. unsigned long immu_tsb_ticks_ctx0_4mb_tte;
  1909. unsigned long __reserved2[2];
  1910. unsigned long immu_tsb_hits_ctx0_256mb_tte;
  1911. unsigned long immu_tsb_ticks_ctx0_256mb_tte;
  1912. unsigned long __reserved3[4];
  1913. unsigned long immu_tsb_hits_ctxnon0_8k_tte;
  1914. unsigned long immu_tsb_ticks_ctxnon0_8k_tte;
  1915. unsigned long immu_tsb_hits_ctxnon0_64k_tte;
  1916. unsigned long immu_tsb_ticks_ctxnon0_64k_tte;
  1917. unsigned long __reserved4[2];
  1918. unsigned long immu_tsb_hits_ctxnon0_4mb_tte;
  1919. unsigned long immu_tsb_ticks_ctxnon0_4mb_tte;
  1920. unsigned long __reserved5[2];
  1921. unsigned long immu_tsb_hits_ctxnon0_256mb_tte;
  1922. unsigned long immu_tsb_ticks_ctxnon0_256mb_tte;
  1923. unsigned long __reserved6[4];
  1924. unsigned long dmmu_tsb_hits_ctx0_8k_tte;
  1925. unsigned long dmmu_tsb_ticks_ctx0_8k_tte;
  1926. unsigned long dmmu_tsb_hits_ctx0_64k_tte;
  1927. unsigned long dmmu_tsb_ticks_ctx0_64k_tte;
  1928. unsigned long __reserved7[2];
  1929. unsigned long dmmu_tsb_hits_ctx0_4mb_tte;
  1930. unsigned long dmmu_tsb_ticks_ctx0_4mb_tte;
  1931. unsigned long __reserved8[2];
  1932. unsigned long dmmu_tsb_hits_ctx0_256mb_tte;
  1933. unsigned long dmmu_tsb_ticks_ctx0_256mb_tte;
  1934. unsigned long __reserved9[4];
  1935. unsigned long dmmu_tsb_hits_ctxnon0_8k_tte;
  1936. unsigned long dmmu_tsb_ticks_ctxnon0_8k_tte;
  1937. unsigned long dmmu_tsb_hits_ctxnon0_64k_tte;
  1938. unsigned long dmmu_tsb_ticks_ctxnon0_64k_tte;
  1939. unsigned long __reserved10[2];
  1940. unsigned long dmmu_tsb_hits_ctxnon0_4mb_tte;
  1941. unsigned long dmmu_tsb_ticks_ctxnon0_4mb_tte;
  1942. unsigned long __reserved11[2];
  1943. unsigned long dmmu_tsb_hits_ctxnon0_256mb_tte;
  1944. unsigned long dmmu_tsb_ticks_ctxnon0_256mb_tte;
  1945. unsigned long __reserved12[4];
  1946. };
  1947. #endif
  1948. /* mmustat_conf()
  1949. * TRAP: HV_FAST_TRAP
  1950. * FUNCTION: HV_FAST_MMUSTAT_CONF
  1951. * ARG0: real address
  1952. * RET0: status
  1953. * RET1: real address
  1954. * ERRORS: ENORADDR Invalid real address
  1955. * EBADALIGN Real address not aligned on 64-byte boundary
  1956. * EBADTRAP API not supported on this processor
  1957. *
  1958. * Enable MMU statistic gathering using the buffer at the given real
  1959. * address on the current virtual CPU. The new buffer real address
  1960. * is given in ARG1, and the previously specified buffer real address
  1961. * is returned in RET1, or is returned as zero for the first invocation.
  1962. *
  1963. * If the passed in real address argument is zero, this will disable
  1964. * MMU statistic collection on the current virtual CPU. If an error is
  1965. * returned then no statistics are collected.
  1966. *
  1967. * The buffer contents should be initialized to all zeros before being
  1968. * given to the hypervisor or else the statistics will be meaningless.
  1969. */
  1970. #define HV_FAST_MMUSTAT_CONF 0x102
  1971. /* mmustat_info()
  1972. * TRAP: HV_FAST_TRAP
  1973. * FUNCTION: HV_FAST_MMUSTAT_INFO
  1974. * RET0: status
  1975. * RET1: real address
  1976. * ERRORS: EBADTRAP API not supported on this processor
  1977. *
  1978. * Return the current state and real address of the currently configured
  1979. * MMU statistics buffer on the current virtual CPU.
  1980. */
  1981. #define HV_FAST_MMUSTAT_INFO 0x103
  1982. /* Function numbers for HV_CORE_TRAP. */
  1983. #define HV_CORE_VER 0x00
  1984. #define HV_CORE_PUTCHAR 0x01
  1985. #define HV_CORE_EXIT 0x02
  1986. #endif /* !(_SPARC64_HYPERVISOR_H) */