hypervisor.h 69 KB

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