dax-hv-api.txt 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433
  1. Excerpt from UltraSPARC Virtual Machine Specification
  2. Compiled from version 3.0.20+15
  3. Publication date 2017-09-25 08:21
  4. Copyright © 2008, 2015 Oracle and/or its affiliates. All rights reserved.
  5. Extracted via "pdftotext -f 547 -l 572 -layout sun4v_20170925.pdf"
  6. Authors:
  7. Charles Kunzman
  8. Sam Glidden
  9. Mark Cianchetti
  10. Chapter 36. Coprocessor services
  11. The following APIs provide access via the Hypervisor to hardware assisted data processing functionality.
  12. These APIs may only be provided by certain platforms, and may not be available to all virtual machines
  13. even on supported platforms. Restrictions on the use of these APIs may be imposed in order to support
  14. live-migration and other system management activities.
  15. 36.1. Data Analytics Accelerator
  16. The Data Analytics Accelerator (DAX) functionality is a collection of hardware coprocessors that provide
  17. high speed processoring of database-centric operations. The coprocessors may support one or more of
  18. the following data query operations: search, extraction, compression, decompression, and translation. The
  19. functionality offered may vary by virtual machine implementation.
  20. The DAX is a virtual device to sun4v guests, with supported data operations indicated by the virtual device
  21. compatibilty property. Functionality is accessed through the submission of Command Control Blocks
  22. (CCBs) via the ccb_submit API function. The operations are processed asynchronously, with the status
  23. of the submitted operations reported through a Completion Area linked to each CCB. Each CCB has a
  24. separate Completion Area and, unless execution order is specifically restricted through the use of serial-
  25. conditional flags, the execution order of submitted CCBs is arbitrary. Likewise, the time to completion
  26. for a given CCB is never guaranteed.
  27. Guest software may implement a software timeout on CCB operations, and if the timeout is exceeded, the
  28. operation may be cancelled or killed via the ccb_kill API function. It is recommended for guest software
  29. to implement a software timeout to account for certain RAS errors which may result in lost CCBs. It is
  30. recommended such implementation use the ccb_info API function to check the status of a CCB prior to
  31. killing it in order to determine if the CCB is still in queue, or may have been lost due to a RAS error.
  32. There is no fixed limit on the number of outstanding CCBs guest software may have queued in the virtual
  33. machine, however, internal resource limitations within the virtual machine can cause CCB submissions
  34. to be temporarily rejected with EWOULDBLOCK. In such cases, guests should continue to attempt
  35. submissions until they succeed; waiting for an outstanding CCB to complete is not necessary, and would
  36. not be a guarantee that a future submission would succeed.
  37. The availablility of DAX coprocessor command service is indicated by the presence of the DAX virtual
  38. device node in the guest MD (Section 8.24.17, “Database Analytics Accelerators (DAX) virtual-device
  39. node”).
  40. 36.1.1. DAX Compatibility Property
  41. The query functionality may vary based on the compatibility property of the virtual device:
  42. 36.1.1.1. "ORCL,sun4v-dax" Device Compatibility
  43. Available CCB commands:
  44. • No-op/Sync
  45. • Extract
  46. • Scan Value
  47. • Inverted Scan Value
  48. • Scan Range
  49. 509
  50. Coprocessor services
  51. • Inverted Scan Range
  52. • Translate
  53. • Inverted Translate
  54. • Select
  55. See Section 36.2.1, “Query CCB Command Formats” for the corresponding CCB input and output formats.
  56. Only version 0 CCBs are available.
  57. 36.1.1.2. "ORCL,sun4v-dax-fc" Device Compatibility
  58. "ORCL,sun4v-dax-fc" is compatible with the "ORCL,sun4v-dax" interface, and includes additional CCB
  59. bit fields and controls.
  60. 36.1.1.3. "ORCL,sun4v-dax2" Device Compatibility
  61. Available CCB commands:
  62. • No-op/Sync
  63. • Extract
  64. • Scan Value
  65. • Inverted Scan Value
  66. • Scan Range
  67. • Inverted Scan Range
  68. • Translate
  69. • Inverted Translate
  70. • Select
  71. See Section 36.2.1, “Query CCB Command Formats” for the corresponding CCB input and output formats.
  72. Version 0 and 1 CCBs are available. Only version 0 CCBs may use Huffman encoded data, whereas only
  73. version 1 CCBs may use OZIP.
  74. 36.1.2. DAX Virtual Device Interrupts
  75. The DAX virtual device has multiple interrupts associated with it which may be used by the guest if
  76. desired. The number of device interrupts available to the guest is indicated in the virtual device node of the
  77. guest MD (Section 8.24.17, “Database Analytics Accelerators (DAX) virtual-device node”). If the device
  78. node indicates N interrupts available, the guest may use any value from 0 to N - 1 (inclusive) in a CCB
  79. interrupt number field. Using values outside this range will result in the CCB being rejected for an invalid
  80. field value.
  81. The interrupts may be bound and managed using the standard sun4v device interrupts API (Chapter 16,
  82. Device interrupt services). Sysino interrupts are not available for DAX devices.
  83. 36.2. Coprocessor Control Block (CCB)
  84. CCBs are either 64 or 128 bytes long, depending on the operation type. The exact contents of the CCB
  85. are command specific, but all CCBs contain at least one memory buffer address. All memory locations
  86. 510
  87. Coprocessor services
  88. referenced by a CCB must be pinned in memory until the CCB either completes execution or is killed
  89. via the ccb_kill API call. Changes in virtual address mappings occurring after CCB submission are not
  90. guaranteed to be visible, and as such all virtual address updates need to be synchronized with CCB
  91. execution.
  92. All CCBs begin with a common 32-bit header.
  93. Table 36.1. CCB Header Format
  94. Bits Field Description
  95. [31:28] CCB version. For API version 2.0: set to 1 if CCB uses OZIP encoding; set to 0 if the CCB
  96. uses Huffman encoding; otherwise either 0 or 1. For API version 1.0: always set to 0.
  97. [27] When API version 2.0 is negotiated, this is the Pipeline Flag [512]. It is reserved in
  98. API version 1.0
  99. [26] Long CCB flag [512]
  100. [25] Conditional synchronization flag [512]
  101. [24] Serial synchronization flag
  102. [23:16] CCB operation code:
  103. 0x00 No Operation (No-op) or Sync
  104. 0x01 Extract
  105. 0x02 Scan Value
  106. 0x12 Inverted Scan Value
  107. 0x03 Scan Range
  108. 0x13 Inverted Scan Range
  109. 0x04 Translate
  110. 0x14 Inverted Translate
  111. 0x05 Select
  112. [15:13] Reserved
  113. [12:11] Table address type
  114. 0b'00 No address
  115. 0b'01 Alternate context virtual address
  116. 0b'10 Real address
  117. 0b'11 Primary context virtual address
  118. [10:8] Output/Destination address type
  119. 0b'000 No address
  120. 0b'001 Alternate context virtual address
  121. 0b'010 Real address
  122. 0b'011 Primary context virtual address
  123. 0b'100 Reserved
  124. 0b'101 Reserved
  125. 0b'110 Reserved
  126. 0b'111 Reserved
  127. [7:5] Secondary source address type
  128. 511
  129. Coprocessor services
  130. Bits Field Description
  131. 0b'000 No address
  132. 0b'001 Alternate context virtual address
  133. 0b'010 Real address
  134. 0b'011 Primary context virtual address
  135. 0b'100 Reserved
  136. 0b'101 Reserved
  137. 0b'110 Reserved
  138. 0b'111 Reserved
  139. [4:2] Primary source address type
  140. 0b'000 No address
  141. 0b'001 Alternate context virtual address
  142. 0b'010 Real address
  143. 0b'011 Primary context virtual address
  144. 0b'100 Reserved
  145. 0b'101 Reserved
  146. 0b'110 Reserved
  147. 0b'111 Reserved
  148. [1:0] Completion area address type
  149. 0b'00 No address
  150. 0b'01 Alternate context virtual address
  151. 0b'10 Real address
  152. 0b'11 Primary context virtual address
  153. The Long CCB flag indicates whether the submitted CCB is 64 or 128 bytes long; value is 0 for 64 bytes
  154. and 1 for 128 bytes.
  155. The Serial and Conditional flags allow simple relative ordering between CCBs. Any CCB with the Serial
  156. flag set will execute sequentially relative to any previous CCB that is also marked as Serial in the same
  157. CCB submission. CCBs without the Serial flag set execute independently, even if they are between CCBs
  158. with the Serial flag set. CCBs marked solely with the Serial flag will execute upon the completion of the
  159. previous Serial CCB, regardless of the completion status of that CCB. The Conditional flag allows CCBs
  160. to conditionally execute based on the successful execution of the closest CCB marked with the Serial flag.
  161. A CCB may only be conditional on exactly one CCB, however, a CCB may be marked both Conditional
  162. and Serial to allow execution chaining. The flags do NOT allow fan-out chaining, where multiple CCBs
  163. execute in parallel based on the completion of another CCB.
  164. The Pipeline flag is an optimization that directs the output of one CCB (the "source" CCB) directly to
  165. the input of the next CCB (the "target" CCB). The target CCB thus does not need to read the input from
  166. memory. The Pipeline flag is advisory and may be dropped.
  167. Both the Pipeline and Serial bits must be set in the source CCB. The Conditional bit must be set in the
  168. target CCB. Exactly one CCB must be made conditional on the source CCB; either 0 or 2 target CCBs
  169. is invalid. However, Pipelines can be extended beyond two CCBs: the sequence would start with a CCB
  170. with both the Pipeline and Serial bits set, proceed through CCBs with the Pipeline, Serial, and Conditional
  171. bits set, and terminate at a CCB that has the Conditional bit set, but not the Pipeline bit.
  172. 512
  173. Coprocessor services
  174. The input of the target CCB must start within 64 bytes of the output of the source CCB or the pipeline flag
  175. will be ignored. All CCBs in a pipeline must be submitted in the same call to ccb_submit.
  176. The various address type fields indicate how the various address values used in the CCB should be
  177. interpreted by the virtual machine. Not all of the types specified are used by every CCB format. Types
  178. which are not applicable to the given CCB command should be indicated as type 0 (No address). Virtual
  179. addresses used in the CCB must have translation entries present in either the TLB or a configured TSB
  180. for the submitting virtual processor. Virtual addresses which cannot be translated by the virtual machine
  181. will result in the CCB submission being rejected, with the causal virtual address indicated. The CCB
  182. may be resubmitted after inserting the translation, or the address may be translated by guest software and
  183. resubmitted using the real address translation.
  184. 36.2.1. Query CCB Command Formats
  185. 36.2.1.1. Supported Data Formats, Elements Sizes and Offsets
  186. Data for query commands may be encoded in multiple possible formats. The data query commands use a
  187. common set of values to indicate the encoding formats of the data being processed. Some encoding formats
  188. require multiple data streams for processing, requiring the specification of both primary data formats (the
  189. encoded data) and secondary data streams (meta-data for the encoded data).
  190. 36.2.1.1.1. Primary Input Format
  191. The primary input format code is a 4-bit field when it is used. There are 10 primary input formats available.
  192. The packed formats are not endian neutral. Code values not listed below are reserved.
  193. Code Format Description
  194. 0x0 Fixed width byte packed Up to 16 bytes
  195. 0x1 Fixed width bit packed Up to 15 bits (CCB version 0) or 23 bits (CCB version
  196. 1); bits are read most significant bit to least significant bit
  197. within a byte
  198. 0x2 Variable width byte packed Data stream of lengths must be provided as a secondary
  199. input
  200. 0x4 Fixed width byte packed with run Up to 16 bytes; data stream of run lengths must be
  201. length encoding provided as a secondary input
  202. 0x5 Fixed width bit packed with run Up to 15 bits (CCB version 0) or 23 bits (CCB version
  203. length encoding 1); bits are read most significant bit to least significant bit
  204. within a byte; data stream of run lengths must be provided
  205. as a secondary input
  206. 0x8 Fixed width byte packed with Up to 16 bytes before the encoding; compressed stream
  207. Huffman (CCB version 0) or bits are read most significant bit to least significant bit
  208. OZIP (CCB version 1) encoding within a byte; pointer to the encoding table must be
  209. provided
  210. 0x9 Fixed width bit packed with Up to 15 bits (CCB version 0) or 23 bits (CCB version
  211. Huffman (CCB version 0) or 1); compressed stream bits are read most significant bit to
  212. OZIP (CCB version 1) encoding least significant bit within a byte; pointer to the encoding
  213. table must be provided
  214. 0xA Variable width byte packed with Up to 16 bytes before the encoding; compressed stream
  215. Huffman (CCB version 0) or bits are read most significant bit to least significant bit
  216. OZIP (CCB version 1) encoding within a byte; data stream of lengths must be provided as
  217. a secondary input; pointer to the encoding table must be
  218. provided
  219. 513
  220. Coprocessor services
  221. Code Format Description
  222. 0xC Fixed width byte packed with Up to 16 bytes before the encoding; compressed stream
  223. run length encoding, followed by bits are read most significant bit to least significant bit
  224. Huffman (CCB version 0) or within a byte; data stream of run lengths must be provided
  225. OZIP (CCB version 1) encoding as a secondary input; pointer to the encoding table must
  226. be provided
  227. 0xD Fixed width bit packed with Up to 15 bits (CCB version 0) or 23 bits(CCB version 1)
  228. run length encoding, followed by before the encoding; compressed stream bits are read most
  229. Huffman (CCB version 0) or significant bit to least significant bit within a byte; data
  230. OZIP (CCB version 1) encoding stream of run lengths must be provided as a secondary
  231. input; pointer to the encoding table must be provided
  232. If OZIP encoding is used, there must be no reserved bytes in the table.
  233. 36.2.1.1.2. Primary Input Element Size
  234. For primary input data streams with fixed size elements, the element size must be indicated in the CCB
  235. command. The size is encoded as the number of bits or bytes, minus one. The valid value range for this
  236. field depends on the input format selected, as listed in the table above.
  237. 36.2.1.1.3. Secondary Input Format
  238. For primary input data streams which require a secondary input stream, the secondary input stream is
  239. always encoded in a fixed width, bit-packed format. The bits are read from most significant bit to least
  240. significant bit within a byte. There are two encoding options for the secondary input stream data elements,
  241. depending on whether the value of 0 is needed:
  242. Secondary Input Description
  243. Format Code
  244. 0 Element is stored as value minus 1 (0 evalutes to 1, 1 evalutes
  245. to 2, etc)
  246. 1 Element is stored as value
  247. 36.2.1.1.4. Secondary Input Element Size
  248. Secondary input element size is encoded as a two bit field:
  249. Secondary Input Size Description
  250. Code
  251. 0x0 1 bit
  252. 0x1 2 bits
  253. 0x2 4 bits
  254. 0x3 8 bits
  255. 36.2.1.1.5. Input Element Offsets
  256. Bit-wise input data streams may have any alignment within the base addressed byte. The offset, specified
  257. from most significant bit to least significant bit, is provided as a fixed 3 bit field for each input type. A
  258. value of 0 indicates that the first input element begins at the most significant bit in the first byte, and a
  259. value of 7 indicates it begins with the least significant bit.
  260. This field should be zero for any byte-wise primary input data streams.
  261. 514
  262. Coprocessor services
  263. 36.2.1.1.6. Output Format
  264. Query commands support multiple sizes and encodings for output data streams. There are four possible
  265. output encodings, and up to four supported element sizes per encoding. Not all output encodings are
  266. supported for every command. The format is indicated by a 4-bit field in the CCB:
  267. Output Format Code Description
  268. 0x0 Byte aligned, 1 byte elements
  269. 0x1 Byte aligned, 2 byte elements
  270. 0x2 Byte aligned, 4 byte elements
  271. 0x3 Byte aligned, 8 byte elements
  272. 0x4 16 byte aligned, 16 byte elements
  273. 0x5 Reserved
  274. 0x6 Reserved
  275. 0x7 Reserved
  276. 0x8 Packed vector of single bit elements
  277. 0x9 Reserved
  278. 0xA Reserved
  279. 0xB Reserved
  280. 0xC Reserved
  281. 0xD 2 byte elements where each element is the index value of a bit,
  282. from an bit vector, which was 1.
  283. 0xE 4 byte elements where each element is the index value of a bit,
  284. from an bit vector, which was 1.
  285. 0xF Reserved
  286. 36.2.1.1.7. Application Data Integrity (ADI)
  287. On platforms which support ADI, the ADI version number may be specified for each separate memory
  288. access type used in the CCB command. ADI checking only occurs when reading data. When writing data,
  289. the specified ADI version number overwrites any existing ADI value in memory.
  290. An ADI version value of 0 or 0xF indicates the ADI checking is disabled for that data access, even if it is
  291. enabled in memory. By setting the appropriate flag in CCB_SUBMIT (Section 36.3.1, “ccb_submit”) it is
  292. also an option to disable ADI checking for all inputs accessed via virtual address for all CCBs submitted
  293. during that hypercall invocation.
  294. The ADI value is only guaranteed to be checked on the first 64 bytes of each data access. Mismatches on
  295. subsequent data chunks may not be detected, so guest software should be careful to use page size checking
  296. to protect against buffer overruns.
  297. 36.2.1.1.8. Page size checking
  298. All data accesses used in CCB commands must be bounded within a single memory page. When addresses
  299. are provided using a virtual address, the page size for checking is extracted from the TTE for that virtual
  300. address. When using real addresses, the guest must supply the page size in the same field as the address
  301. value. The page size must be one of the sizes supported by the underlying virtual machine. Using a value
  302. that is not supported may result in the CCB submission being rejected or the generation of a CCB parsing
  303. error in the completion area.
  304. 515
  305. Coprocessor services
  306. 36.2.1.2. Extract command
  307. Converts an input vector in one format to an output vector in another format. All input format types are
  308. supported.
  309. The only supported output format is a padded, byte-aligned output stream, using output codes 0x0 - 0x4.
  310. When the specified output element size is larger than the extracted input element size, zeros are padded to
  311. the extracted input element. First, if the decompressed input size is not a whole number of bytes, 0 bits are
  312. padded to the most significant bit side till the next byte boundary. Next, if the output element size is larger
  313. than the byte padded input element, bytes of value 0 are added based on the Padding Direction bit in the
  314. CCB. If the output element size is smaller than the byte-padded input element size, the input element is
  315. truncated by dropped from the least significant byte side until the selected output size is reached.
  316. The return value of the CCB completion area is invalid. The “number of elements processed” field in the
  317. CCB completion area will be valid.
  318. The extract CCB is a 64-byte “short format” CCB.
  319. The extract CCB command format can be specified by the following packed C structure for a big-endian
  320. machine:
  321. struct extract_ccb {
  322. uint32_t header;
  323. uint32_t control;
  324. uint64_t completion;
  325. uint64_t primary_input;
  326. uint64_t data_access_control;
  327. uint64_t secondary_input;
  328. uint64_t reserved;
  329. uint64_t output;
  330. uint64_t table;
  331. };
  332. The exact field offsets, sizes, and composition are as follows:
  333. Offset Size Field Description
  334. 0 4 CCB header (Table 36.1, “CCB Header Format”)
  335. 4 4 Command control
  336. Bits Field Description
  337. [31:28] Primary Input Format (see Section 36.2.1.1.1, “Primary Input
  338. Format”)
  339. [27:23] Primary Input Element Size (see Section 36.2.1.1.2, “Primary
  340. Input Element Size”)
  341. [22:20] Primary Input Starting Offset (see Section 36.2.1.1.5, “Input
  342. Element Offsets”)
  343. [19] Secondary Input Format (see Section 36.2.1.1.3, “Secondary
  344. Input Format”)
  345. [18:16] Secondary Input Starting Offset (see Section 36.2.1.1.5, “Input
  346. Element Offsets”)
  347. 516
  348. Coprocessor services
  349. Offset Size Field Description
  350. Bits Field Description
  351. [15:14] Secondary Input Element Size (see Section 36.2.1.1.4,
  352. “Secondary Input Element Size”
  353. [13:10] Output Format (see Section 36.2.1.1.6, “Output Format”)
  354. [9] Padding Direction selector: A value of 1 causes padding bytes
  355. to be added to the left side of output elements. A value of 0
  356. causes padding bytes to be added to the right side of output
  357. elements.
  358. [8:0] Reserved
  359. 8 8 Completion
  360. Bits Field Description
  361. [63:60] ADI version (see Section 36.2.1.1.7, “Application Data
  362. Integrity (ADI)”)
  363. [59] If set to 1, a virtual device interrupt will be generated using
  364. the device interrupt number specified in the lower bits of this
  365. completion word. If 0, the lower bits of this completion word
  366. are ignored.
  367. [58:6] Completion area address bits [58:6]. Address type is
  368. determined by CCB header.
  369. [5:0] Virtual device interrupt number for completion interrupt, if
  370. enabled.
  371. 16 8 Primary Input
  372. Bits Field Description
  373. [63:60] ADI version (see Section 36.2.1.1.7, “Application Data
  374. Integrity (ADI)”)
  375. [59:56] If using real address, these bits should be filled in with the
  376. page size code for the page boundary checking the guest wants
  377. the virtual machine to use when accessing this data stream
  378. (checking is only guaranteed to be performed when using API
  379. version 1.1 and later). If using a virtual address, this field will
  380. be used as as primary input address bits [59:56].
  381. [55:0] Primary input address bits [55:0]. Address type is determined
  382. by CCB header.
  383. 24 8 Data Access Control
  384. Bits Field Description
  385. [63:62] Flow Control
  386. Value Description
  387. 0b'00 Disable flow control
  388. 0b'01 Enable flow control (only valid with "ORCL,sun4v-
  389. dax-fc" compatible virtual device variants)
  390. 0b'10 Reserved
  391. 0b'11 Reserved
  392. [61:60] Reserved (API 1.0)
  393. 517
  394. Coprocessor services
  395. Offset Size Field Description
  396. Bits Field Description
  397. Pipeline target (API 2.0)
  398. Value Description
  399. 0b'00 Connect to primary input
  400. 0b'01 Connect to secondary input
  401. 0b'10 Reserved
  402. 0b'11 Reserved
  403. [59:40] Output buffer size given in units of 64 bytes, minus 1. Value of
  404. 0 means 64 bytes, value of 1 means 128 bytes, etc. Buffer size is
  405. only enforced if flow control is enabled in Flow Control field.
  406. [39:32] Reserved
  407. [31:30] Output Data Cache Allocation
  408. Value Description
  409. 0b'00 Do not allocate cache lines for output data stream.
  410. 0b'01 Force cache lines for output data stream to be
  411. allocated in the cache that is local to the submitting
  412. virtual cpu.
  413. 0b'10 Allocate cache lines for output data stream, but allow
  414. existing cache lines associated with the data to remain
  415. in their current cache instance. Any memory not
  416. already in cache will be allocated in the cache local
  417. to the submitting virtual cpu.
  418. 0b'11 Reserved
  419. [29:26] Reserved
  420. [25:24] Primary Input Length Format
  421. Value Description
  422. 0b'00 Number of primary symbols
  423. 0b'01 Number of primary bytes
  424. 0b'10 Number of primary bits
  425. 0b'11 Reserved
  426. [23:0] Primary Input Length
  427. Format Field Value
  428. # of primary symbols Number of input elements to process,
  429. minus 1. Command execution stops
  430. once count is reached.
  431. # of primary bytes Number of input bytes to process,
  432. minus 1. Command execution stops
  433. once count is reached. The count is
  434. done before any decompression or
  435. decoding.
  436. # of primary bits Number of input bits to process,
  437. minus 1. Command execution stops
  438. 518
  439. Coprocessor services
  440. Offset Size Field Description
  441. Bits Field Description
  442. Format Field Value
  443. once count is reached. The count is
  444. done before any decompression or
  445. decoding, and does not include any
  446. bits skipped by the Primary Input
  447. Offset field value of the command
  448. control word.
  449. 32 8 Secondary Input, if used by Primary Input Format. Same fields as Primary
  450. Input.
  451. 40 8 Reserved
  452. 48 8 Output (same fields as Primary Input)
  453. 56 8 Symbol Table (if used by Primary Input)
  454. Bits Field Description
  455. [63:60] ADI version (see Section 36.2.1.1.7, “Application Data
  456. Integrity (ADI)”)
  457. [59:56] If using real address, these bits should be filled in with the
  458. page size code for the page boundary checking the guest wants
  459. the virtual machine to use when accessing this data stream
  460. (checking is only guaranteed to be performed when using API
  461. version 1.1 and later). If using a virtual address, this field will
  462. be used as as symbol table address bits [59:56].
  463. [55:4] Symbol table address bits [55:4]. Address type is determined
  464. by CCB header.
  465. [3:0] Symbol table version
  466. Value Description
  467. 0 Huffman encoding. Must use 64 byte aligned table
  468. address. (Only available when using version 0 CCBs)
  469. 1 OZIP encoding. Must use 16 byte aligned table
  470. address. (Only available when using version 1 CCBs)
  471. 36.2.1.3. Scan commands
  472. The scan commands search a stream of input data elements for values which match the selection criteria.
  473. All the input format types are supported. There are multiple formats for the scan commands, allowing the
  474. scan to search for exact matches to one value, exact matches to either of two values, or any value within
  475. a specified range. The specific type of scan is indicated by the command code in the CCB header. For the
  476. scan range commands, the boundary conditions can be specified as greater-than-or-equal-to a value, less-
  477. than-or-equal-to a value, or both by using two boundary values.
  478. There are two supported formats for the output stream: the bit vector and index array formats (codes 0x8,
  479. 0xD, and 0xE). For the standard scan command using the bit vector output, for each input element there
  480. exists one bit in the vector that is set if the input element matched the scan criteria, or clear if not. The
  481. inverted scan command inverts the polarity of the bits in the output. The most significant bit of the first
  482. byte of the output stream corresponds to the first element in the input stream. The standard index array
  483. output format contains one array entry for each input element that matched the scan criteria. Each array
  484. 519
  485. Coprocessor services
  486. entry is the index of an input element that matched the scan criteria. An inverted scan command produces
  487. a similar array, but of all the input elements which did NOT match the scan criteria.
  488. The return value of the CCB completion area contains the number of input elements found which match
  489. the scan criteria (or number that did not match for the inverted scans). The “number of elements processed”
  490. field in the CCB completion area will be valid, indicating the number of input elements processed.
  491. These commands are 128-byte “long format” CCBs.
  492. The scan CCB command format can be specified by the following packed C structure for a big-endian
  493. machine:
  494. struct scan_ccb {
  495. uint32_t header;
  496. uint32_t control;
  497. uint64_t completion;
  498. uint64_t primary_input;
  499. uint64_t data_access_control;
  500. uint64_t secondary_input;
  501. uint64_t match_criteria0;
  502. uint64_t output;
  503. uint64_t table;
  504. uint64_t match_criteria1;
  505. uint64_t match_criteria2;
  506. uint64_t match_criteria3;
  507. uint64_t reserved[5];
  508. };
  509. The exact field offsets, sizes, and composition are as follows:
  510. Offset Size Field Description
  511. 0 4 CCB header (Table 36.1, “CCB Header Format”)
  512. 4 4 Command control
  513. Bits Field Description
  514. [31:28] Primary Input Format (see Section 36.2.1.1.1, “Primary Input
  515. Format”)
  516. [27:23] Primary Input Element Size (see Section 36.2.1.1.2, “Primary
  517. Input Element Size”)
  518. [22:20] Primary Input Starting Offset (see Section 36.2.1.1.5, “Input
  519. Element Offsets”)
  520. [19] Secondary Input Format (see Section 36.2.1.1.3, “Secondary
  521. Input Format”)
  522. [18:16] Secondary Input Starting Offset (see Section 36.2.1.1.5, “Input
  523. Element Offsets”)
  524. [15:14] Secondary Input Element Size (see Section 36.2.1.1.4,
  525. “Secondary Input Element Size”
  526. [13:10] Output Format (see Section 36.2.1.1.6, “Output Format”)
  527. [9:5] Operand size for first scan criteria value. In a scan value
  528. operation, this is one of two potential extact match values.
  529. In a scan range operation, this is the size of the upper range
  530. 520
  531. Coprocessor services
  532. Offset Size Field Description
  533. Bits Field Description
  534. boundary. The value of this field is the number of bytes in the
  535. operand, minus 1. Values 0xF-0x1E are reserved. A value of
  536. 0x1F indicates this operand is not in use for this scan operation.
  537. [4:0] Operand size for second scan criteria value. In a scan value
  538. operation, this is one of two potential extact match values.
  539. In a scan range operation, this is the size of the lower range
  540. boundary. The value of this field is the number of bytes in the
  541. operand, minus 1. Values 0xF-0x1E are reserved. A value of
  542. 0x1F indicates this operand is not in use for this scan operation.
  543. 8 8 Completion (same fields as Section 36.2.1.2, “Extract command”)
  544. 16 8 Primary Input (same fields as Section 36.2.1.2, “Extract command”)
  545. 24 8 Data Access Control (same fields as Section 36.2.1.2, “Extract command”)
  546. 32 8 Secondary Input, if used by Primary Input Format. Same fields as Primary
  547. Input.
  548. 40 4 Most significant 4 bytes of first scan criteria operand. If first operand is less
  549. than 4 bytes, the value is left-aligned to the lowest address bytes.
  550. 44 4 Most significant 4 bytes of second scan criteria operand. If second operand
  551. is less than 4 bytes, the value is left-aligned to the lowest address bytes.
  552. 48 8 Output (same fields as Primary Input)
  553. 56 8 Symbol Table (if used by Primary Input). Same fields as Section 36.2.1.2,
  554. “Extract command”
  555. 64 4 Next 4 most significant bytes of first scan criteria operand occuring after the
  556. bytes specified at offset 40, if needed by the operand size. If first operand
  557. is less than 8 bytes, the valid bytes are left-aligned to the lowest address.
  558. 68 4 Next 4 most significant bytes of second scan criteria operand occuring after
  559. the bytes specified at offset 44, if needed by the operand size. If second
  560. operand is less than 8 bytes, the valid bytes are left-aligned to the lowest
  561. address.
  562. 72 4 Next 4 most significant bytes of first scan criteria operand occuring after the
  563. bytes specified at offset 64, if needed by the operand size. If first operand
  564. is less than 12 bytes, the valid bytes are left-aligned to the lowest address.
  565. 76 4 Next 4 most significant bytes of second scan criteria operand occuring after
  566. the bytes specified at offset 68, if needed by the operand size. If second
  567. operand is less than 12 bytes, the valid bytes are left-aligned to the lowest
  568. address.
  569. 80 4 Next 4 most significant bytes of first scan criteria operand occuring after the
  570. bytes specified at offset 72, if needed by the operand size. If first operand
  571. is less than 16 bytes, the valid bytes are left-aligned to the lowest address.
  572. 84 4 Next 4 most significant bytes of second scan criteria operand occuring after
  573. the bytes specified at offset 76, if needed by the operand size. If second
  574. operand is less than 16 bytes, the valid bytes are left-aligned to the lowest
  575. address.
  576. 521
  577. Coprocessor services
  578. 36.2.1.4. Translate commands
  579. The translate commands takes an input array of indicies, and a table of single bit values indexed by those
  580. indicies, and outputs a bit vector or index array created by reading the tables bit value at each index in
  581. the input array. The output should therefore contain exactly one bit per index in the input data stream,
  582. when outputing as a bit vector. When outputing as an index array, the number of elements depends on the
  583. values read in the bit table, but will always be less than, or equal to, the number of input elements. Only
  584. a restricted subset of the possible input format types are supported. No variable width or Huffman/OZIP
  585. encoded input streams are allowed. The primary input data element size must be 3 bytes or less.
  586. The maximum table index size allowed is 15 bits, however, larger input elements may be used to provide
  587. additional processing of the output values. If 2 or 3 byte values are used, the least significant 15 bits are
  588. used as an index into the bit table. The most significant 9 bits (when using 3-byte input elements) or single
  589. bit (when using 2-byte input elements) are compared against a fixed 9-bit test value provided in the CCB.
  590. If the values match, the value from the bit table is used as the output element value. If the values do not
  591. match, the output data element value is forced to 0.
  592. In the inverted translate operation, the bit value read from bit table is inverted prior to its use. The additional
  593. additional processing based on any additional non-index bits remains unchanged, and still forces the output
  594. element value to 0 on a mismatch. The specific type of translate command is indicated by the command
  595. code in the CCB header.
  596. There are two supported formats for the output stream: the bit vector and index array formats (codes 0x8,
  597. 0xD, and 0xE). The index array format is an array of indicies of bits which would have been set if the
  598. output format was a bit array.
  599. The return value of the CCB completion area contains the number of bits set in the output bit vector,
  600. or number of elements in the output index array. The “number of elements processed” field in the CCB
  601. completion area will be valid, indicating the number of input elements processed.
  602. These commands are 64-byte “short format” CCBs.
  603. The translate CCB command format can be specified by the following packed C structure for a big-endian
  604. machine:
  605. struct translate_ccb {
  606. uint32_t header;
  607. uint32_t control;
  608. uint64_t completion;
  609. uint64_t primary_input;
  610. uint64_t data_access_control;
  611. uint64_t secondary_input;
  612. uint64_t reserved;
  613. uint64_t output;
  614. uint64_t table;
  615. };
  616. The exact field offsets, sizes, and composition are as follows:
  617. Offset Size Field Description
  618. 0 4 CCB header (Table 36.1, “CCB Header Format”)
  619. 522
  620. Coprocessor services
  621. Offset Size Field Description
  622. 4 4 Command control
  623. Bits Field Description
  624. [31:28] Primary Input Format (see Section 36.2.1.1.1, “Primary Input
  625. Format”)
  626. [27:23] Primary Input Element Size (see Section 36.2.1.1.2, “Primary
  627. Input Element Size”)
  628. [22:20] Primary Input Starting Offset (see Section 36.2.1.1.5, “Input
  629. Element Offsets”)
  630. [19] Secondary Input Format (see Section 36.2.1.1.3, “Secondary
  631. Input Format”)
  632. [18:16] Secondary Input Starting Offset (see Section 36.2.1.1.5, “Input
  633. Element Offsets”)
  634. [15:14] Secondary Input Element Size (see Section 36.2.1.1.4,
  635. “Secondary Input Element Size”
  636. [13:10] Output Format (see Section 36.2.1.1.6, “Output Format”)
  637. [9] Reserved
  638. [8:0] Test value used for comparison against the most significant bits
  639. in the input values, when using 2 or 3 byte input elements.
  640. 8 8 Completion (same fields as Section 36.2.1.2, “Extract command”
  641. 16 8 Primary Input (same fields as Section 36.2.1.2, “Extract command”
  642. 24 8 Data Access Control (same fields as Section 36.2.1.2, “Extract command”,
  643. except Primary Input Length Format may not use the 0x0 value)
  644. 32 8 Secondary Input, if used by Primary Input Format. Same fields as Primary
  645. Input.
  646. 40 8 Reserved
  647. 48 8 Output (same fields as Primary Input)
  648. 56 8 Bit Table
  649. Bits Field Description
  650. [63:60] ADI version (see Section 36.2.1.1.7, “Application Data
  651. Integrity (ADI)”)
  652. [59:56] If using real address, these bits should be filled in with the
  653. page size code for the page boundary checking the guest wants
  654. the virtual machine to use when accessing this data stream
  655. (checking is only guaranteed to be performed when using API
  656. version 1.1 and later). If using a virtual address, this field will
  657. be used as as bit table address bits [59:56]
  658. [55:4] Bit table address bits [55:4]. Address type is determined by
  659. CCB header. Address must be 64-byte aligned (CCB version
  660. 0) or 16-byte aligned (CCB version 1).
  661. [3:0] Bit table version
  662. Value Description
  663. 0 4KB table size
  664. 1 8KB table size
  665. 523
  666. Coprocessor services
  667. 36.2.1.5. Select command
  668. The select command filters the primary input data stream by using a secondary input bit vector to determine
  669. which input elements to include in the output. For each bit set at a given index N within the bit vector,
  670. the Nth input element is included in the output. If the bit is not set, the element is not included. Only a
  671. restricted subset of the possible input format types are supported. No variable width or run length encoded
  672. input streams are allowed, since the secondary input stream is used for the filtering bit vector.
  673. The only supported output format is a padded, byte-aligned output stream. The stream follows the same
  674. rules and restrictions as padded output stream described in Section 36.2.1.2, “Extract command”.
  675. The return value of the CCB completion area contains the number of bits set in the input bit vector. The
  676. "number of elements processed" field in the CCB completion area will be valid, indicating the number
  677. of input elements processed.
  678. The select CCB is a 64-byte “short format” CCB.
  679. The select CCB command format can be specified by the following packed C structure for a big-endian
  680. machine:
  681. struct select_ccb {
  682. uint32_t header;
  683. uint32_t control;
  684. uint64_t completion;
  685. uint64_t primary_input;
  686. uint64_t data_access_control;
  687. uint64_t secondary_input;
  688. uint64_t reserved;
  689. uint64_t output;
  690. uint64_t table;
  691. };
  692. The exact field offsets, sizes, and composition are as follows:
  693. Offset Size Field Description
  694. 0 4 CCB header (Table 36.1, “CCB Header Format”)
  695. 4 4 Command control
  696. Bits Field Description
  697. [31:28] Primary Input Format (see Section 36.2.1.1.1, “Primary Input
  698. Format”)
  699. [27:23] Primary Input Element Size (see Section 36.2.1.1.2, “Primary
  700. Input Element Size”)
  701. [22:20] Primary Input Starting Offset (see Section 36.2.1.1.5, “Input
  702. Element Offsets”)
  703. [19] Secondary Input Format (see Section 36.2.1.1.3, “Secondary
  704. Input Format”)
  705. [18:16] Secondary Input Starting Offset (see Section 36.2.1.1.5, “Input
  706. Element Offsets”)
  707. [15:14] Secondary Input Element Size (see Section 36.2.1.1.4,
  708. “Secondary Input Element Size”
  709. 524
  710. Coprocessor services
  711. Offset Size Field Description
  712. Bits Field Description
  713. [13:10] Output Format (see Section 36.2.1.1.6, “Output Format”)
  714. [9] Padding Direction selector: A value of 1 causes padding bytes
  715. to be added to the left side of output elements. A value of 0
  716. causes padding bytes to be added to the right side of output
  717. elements.
  718. [8:0] Reserved
  719. 8 8 Completion (same fields as Section 36.2.1.2, “Extract command”
  720. 16 8 Primary Input (same fields as Section 36.2.1.2, “Extract command”
  721. 24 8 Data Access Control (same fields as Section 36.2.1.2, “Extract command”)
  722. 32 8 Secondary Bit Vector Input. Same fields as Primary Input.
  723. 40 8 Reserved
  724. 48 8 Output (same fields as Primary Input)
  725. 56 8 Symbol Table (if used by Primary Input). Same fields as Section 36.2.1.2,
  726. “Extract command”
  727. 36.2.1.6. No-op and Sync commands
  728. The no-op (no operation) command is a CCB which has no processing effect. The CCB, when processed
  729. by the virtual machine, simply updates the completion area with its execution status. The CCB may have
  730. the serial-conditional flags set in order to restrict when it executes.
  731. The sync command is a variant of the no-op command which with restricted execution timing. A sync
  732. command CCB will only execute when all previous commands submitted in the same request have
  733. completed. This is stronger than the conditional flag sequencing, which is only dependent on a single
  734. previous serial CCB. While the relative ordering is guaranteed, virtual machine implementations with
  735. shared hardware resources may cause the sync command to wait for longer than the minimum required
  736. time.
  737. The return value of the CCB completion area is invalid for these CCBs. The “number of elements
  738. processed” field is also invalid for these CCBs.
  739. These commands are 64-byte “short format” CCBs.
  740. The no-op CCB command format can be specified by the following packed C structure for a big-endian
  741. machine:
  742. struct nop_ccb {
  743. uint32_t header;
  744. uint32_t control;
  745. uint64_t completion;
  746. uint64_t reserved[6];
  747. };
  748. The exact field offsets, sizes, and composition are as follows:
  749. Offset Size Field Description
  750. 0 4 CCB header (Table 36.1, “CCB Header Format”)
  751. 525
  752. Coprocessor services
  753. Offset Size Field Description
  754. 4 4 Command control
  755. Bits Field Description
  756. [31] If set, this CCB functions as a Sync command. If clear, this
  757. CCB functions as a No-op command.
  758. [30:0] Reserved
  759. 8 8 Completion (same fields as Section 36.2.1.2, “Extract command”
  760. 16 46 Reserved
  761. 36.2.2. CCB Completion Area
  762. All CCB commands use a common 128-byte Completion Area format, which can be specified by the
  763. following packed C structure for a big-endian machine:
  764. struct completion_area {
  765. uint8_t status_flag;
  766. uint8_t error_note;
  767. uint8_t rsvd0[2];
  768. uint32_t error_values;
  769. uint32_t output_size;
  770. uint32_t rsvd1;
  771. uint64_t run_time;
  772. uint64_t run_stats;
  773. uint32_t elements;
  774. uint8_t rsvd2[20];
  775. uint64_t return_value;
  776. uint64_t extra_return_value[8];
  777. };
  778. The Completion Area must be a 128-byte aligned memory location. The exact layout can be described
  779. using byte offsets and sizes relative to the memory base:
  780. Offset Size Field Description
  781. 0 1 CCB execution status
  782. 0x0 Command not yet completed
  783. 0x1 Command ran and succeeded
  784. 0x2 Command ran and failed (partial results may be been
  785. produced)
  786. 0x3 Command ran and was killed (partial execution may
  787. have occurred)
  788. 0x4 Command was not run
  789. 0x5-0xF Reserved
  790. 1 1 Error reason code
  791. 0x0 Reserved
  792. 0x1 Buffer overflow
  793. 526
  794. Coprocessor services
  795. Offset Size Field Description
  796. 0x2 CCB decoding error
  797. 0x3 Page overflow
  798. 0x4-0x6 Reserved
  799. 0x7 Command was killed
  800. 0x8 Command execution timeout
  801. 0x9 ADI miscompare error
  802. 0xA Data format error
  803. 0xB-0xD Reserved
  804. 0xE Unexpected hardware error (Do not retry)
  805. 0xF Unexpected hardware error (Retry is ok)
  806. 0x10-0x7F Reserved
  807. 0x80 Partial Symbol Warning
  808. 0x81-0xFF Reserved
  809. 2 2 Reserved
  810. 4 4 If a partial symbol warning was generated, this field contains the number
  811. of remaining bits which were not decoded.
  812. 8 4 Number of bytes of output produced
  813. 12 4 Reserved
  814. 16 8 Runtime of command (unspecified time units)
  815. 24 8 Reserved
  816. 32 4 Number of elements processed
  817. 36 20 Reserved
  818. 56 8 Return value
  819. 64 64 Extended return value
  820. The CCB completion area should be treated as read-only by guest software. The CCB execution status
  821. byte will be cleared by the Hypervisor to reflect the pending execution status when the CCB is submitted
  822. successfully. All other fields are considered invalid upon CCB submission until the CCB execution status
  823. byte becomes non-zero.
  824. CCBs which complete with status 0x2 or 0x3 may produce partial results and/or side effects due to partial
  825. execution of the CCB command. Some valid data may be accessible depending on the fault type, however,
  826. it is recommended that guest software treat the destination buffer as being in an unknown state. If a CCB
  827. completes with a status byte of 0x2, the error reason code byte can be read to determine what corrective
  828. action should be taken.
  829. A buffer overflow indicates that the results of the operation exceeded the size of the output buffer indicated
  830. in the CCB. The operation can be retried by resubmitting the CCB with a larger output buffer.
  831. A CCB decoding error indicates that the CCB contained some invalid field values. It may be also be
  832. triggered if the CCB output is directed at a non-existent secondary input and the pipelining hint is followed.
  833. A page overflow error indicates that the operation required accessing a memory location beyond the page
  834. size associated with a given address. No data will have been read or written past the page boundary, but
  835. partial results may have been written to the destination buffer. The CCB can be resubmitted with a larger
  836. page size memory allocation to complete the operation.
  837. 527
  838. Coprocessor services
  839. In the case of pipelined CCBs, a page overflow error will be triggered if the output from the pipeline source
  840. CCB ends before the input of the pipeline target CCB. Page boundaries are ignored when the pipeline
  841. hint is followed.
  842. Command kill indicates that the CCB execution was halted or prevented by use of the ccb_kill API call.
  843. Command timeout indicates that the CCB execution began, but did not complete within a pre-determined
  844. limit set by the virtual machine. The command may have produced some or no output. The CCB may be
  845. resubmitted with no alterations.
  846. ADI miscompare indicates that the memory buffer version specified in the CCB did not match the value
  847. in memory when accessed by the virtual machine. Guest software should not attempt to resubmit the CCB
  848. without determining the cause of the version mismatch.
  849. A data format error indicates that the input data stream did not follow the specified data input formatting
  850. selected in the CCB.
  851. Some CCBs which encounter hardware errors may be resubmitted without change. Persistent hardware
  852. errors may result in multiple failures until RAS software can identify and isolate the faulty component.
  853. The output size field indicates the number of bytes of valid output in the destination buffer. This field is
  854. not valid for all possible CCB commands.
  855. The runtime field indicates the execution time of the CCB command once it leaves the internal virtual
  856. machine queue. The time units are fixed, but unspecified, allowing only relative timing comparisons
  857. by guest software. The time units may also vary by hardware platform, and should not be construed to
  858. represent any absolute time value.
  859. Some data query commands process data in units of elements. If applicable to the command, the number of
  860. elements processed is indicated in the listed field. This field is not valid for all possible CCB commands.
  861. The return value and extended return value fields are output locations for commands which do not use
  862. a destination output buffer, or have secondary return results. The field is not valid for all possible CCB
  863. commands.
  864. 36.3. Hypervisor API Functions
  865. 36.3.1. ccb_submit
  866. trap# FAST_TRAP
  867. function# CCB_SUBMIT
  868. arg0 address
  869. arg1 length
  870. arg2 flags
  871. arg3 reserved
  872. ret0 status
  873. ret1 length
  874. ret2 status data
  875. ret3 reserved
  876. Submit one or more coprocessor control blocks (CCBs) for evaluation and processing by the virtual
  877. machine. The CCBs are passed in a linear array indicated by address. length indicates the size of
  878. the array in bytes.
  879. 528
  880. Coprocessor services
  881. The address should be aligned to the size indicated by length, rounded up to the nearest power of
  882. two. Virtual machines implementations may reject submissions which do not adhere to that alignment.
  883. length must be a multiple of 64 bytes. If length is zero, the maximum supported array length will be
  884. returned as length in ret1. In all other cases, the length value in ret1 will reflect the number of bytes
  885. successfully consumed from the input CCB array.
  886. Implementation note
  887. Virtual machines should never reject submissions based on the alignment of address if the
  888. entire array is contained within a single memory page of the smallest page size supported by the
  889. virtual machine.
  890. A guest may choose to submit addresses used in this API function, including the CCB array address,
  891. as either a real or virtual addresses, with the type of each address indicated in flags. Virtual addresses
  892. must be present in either the TLB or an active TSB to be processed. The translation context for virtual
  893. addresses is determined by a combination of CCB contents and the flags argument.
  894. The flags argument is divided into multiple fields defined as follows:
  895. Bits Field Description
  896. [63:16] Reserved
  897. [15] Disable ADI for VA reads (in API 2.0)
  898. Reserved (in API 1.0)
  899. [14] Virtual addresses within CCBs are translated in privileged context
  900. [13:12] Alternate translation context for virtual addresses within CCBs:
  901. 0b'00 CCBs requesting alternate context are rejected
  902. 0b'01 Reserved
  903. 0b'10 CCBs requesting alternate context use secondary context
  904. 0b'11 CCBs requesting alternate context use nucleus context
  905. [11:9] Reserved
  906. [8] Queue info flag
  907. [7] All-or-nothing flag
  908. [6] If address is a virtual address, treat its translation context as privileged
  909. [5:4] Address type of address:
  910. 0b'00 Real address
  911. 0b'01 Virtual address in primary context
  912. 0b'10 Virtual address in secondary context
  913. 0b'11 Virtual address in nucleus context
  914. [3:2] Reserved
  915. [1:0] CCB command type:
  916. 0b'00 Reserved
  917. 0b'01 Reserved
  918. 0b'10 Query command
  919. 0b'11 Reserved
  920. 529
  921. Coprocessor services
  922. The CCB submission type and address type for the CCB array must be provided in the flags argument.
  923. All other fields are optional values which change the default behavior of the CCB processing.
  924. When set to one, the "Disable ADI for VA reads" bit will turn off ADI checking when using a virtual
  925. address to load data. ADI checking will still be done when loading real-addressed memory. This bit is only
  926. available when using major version 2 of the coprocessor API group; at major version 1 it is reserved. For
  927. more information about using ADI and DAX, see Section 36.2.1.1.7, “Application Data Integrity (ADI)”.
  928. By default, all virtual addresses are treated as user addresses. If the virtual address translations are
  929. privileged, they must be marked as such in the appropriate flags field. The virtual addresses used within
  930. the submitted CCBs must all be translated with the same privilege level.
  931. By default, all virtual addresses used within the submitted CCBs are translated using the primary context
  932. active at the time of the submission. The address type field within a CCB allows each address to request
  933. translation in an alternate address context. The address context used when the alternate address context is
  934. requested is selected in the flags argument.
  935. The all-or-nothing flag specifies whether the virtual machine should allow partial submissions of the
  936. input CCB array. When using CCBs with serial-conditional flags, it is strongly recommended to use
  937. the all-or-nothing flag to avoid broken conditional chains. Using long CCB chains on a machine under
  938. high coprocessor load may make this impractical, however, and require submitting without the flag.
  939. When submitting serial-conditional CCBs without the all-or-nothing flag, guest software must manually
  940. implement the serial-conditional behavior at any point where the chain was not submitted in a single API
  941. call, and resubmission of the remaining CCBs should clear any conditional flag that might be set in the
  942. first remaining CCB. Failure to do so will produce indeterminate CCB execution status and ordering.
  943. When the all-or-nothing flag is not specified, callers should check the value of length in ret1 to determine
  944. how many CCBs from the array were successfully submitted. Any remaining CCBs can be resubmitted
  945. without modifications.
  946. The value of length in ret1 is also valid when the API call returns an error, and callers should always
  947. check its value to determine which CCBs in the array were already processed. This will additionally
  948. identify which CCB encountered the processing error, and was not submitted successfully.
  949. If the queue info flag is used during submission, and at least one CCB was successfully submitted, the
  950. length value in ret1 will be a multi-field value defined as follows:
  951. Bits Field Description
  952. [63:48] DAX unit instance identifier
  953. [47:32] DAX queue instance identifier
  954. [31:16] Reserved
  955. [15:0] Number of CCB bytes successfully submitted
  956. The value of status data depends on the status value. See error status code descriptions for details.
  957. The value is undefined for status values that do not specifically list a value for the status data.
  958. The API has a reserved input and output register which will be used in subsequent minor versions of this
  959. API function. Guest software implementations should treat that register as voltile across the function call
  960. in order to maintain forward compatibility.
  961. 36.3.1.1. Errors
  962. EOK One or more CCBs have been accepted and enqueued in the virtual machine
  963. and no errors were been encountered during submission. Some submitted
  964. CCBs may not have been enqueued due to internal virtual machine limitations,
  965. and may be resubmitted without changes.
  966. 530
  967. Coprocessor services
  968. EWOULDBLOCK An internal resource conflict within the virtual machine has prevented it from
  969. being able to complete the CCB submissions sufficiently quickly, requiring
  970. it to abandon processing before it was complete. Some CCBs may have been
  971. successfully enqueued prior to the block, and all remaining CCBs may be
  972. resubmitted without changes.
  973. EBADALIGN CCB array is not on a 64-byte boundary, or the array length is not a multiple
  974. of 64 bytes.
  975. ENORADDR A real address used either for the CCB array, or within one of the submitted
  976. CCBs, is not valid for the guest. Some CCBs may have been enqueued prior
  977. to the error being detected.
  978. ENOMAP A virtual address used either for the CCB array, or within one of the submitted
  979. CCBs, could not be translated by the virtual machine using either the TLB
  980. or TSB contents. The submission may be retried after adding the required
  981. mapping, or by converting the virtual address into a real address. Due to the
  982. shared nature of address translation resources, there is no theoretical limit on
  983. the number of times the translation may fail, and it is recommended all guests
  984. implement some real address based backup. The virtual address which failed
  985. translation is returned as status data in ret2. Some CCBs may have been
  986. enqueued prior to the error being detected.
  987. EINVAL The virtual machine detected an invalid CCB during submission, or invalid
  988. input arguments, such as bad flag values. Note that not all invalid CCB values
  989. will be detected during submission, and some may be reported as errors in the
  990. completion area instead. Some CCBs may have been enqueued prior to the
  991. error being detected. This error may be returned if the CCB version is invalid.
  992. ETOOMANY The request was submitted with the all-or-nothing flag set, and the array size is
  993. greater than the virtual machine can support in a single request. The maximum
  994. supported size for the current virtual machine can be queried by submitting a
  995. request with a zero length array, as described above.
  996. ENOACCESS The guest does not have permission to submit CCBs, or an address used in a
  997. CCBs lacks sufficient permissions to perform the required operation (no write
  998. permission on the destination buffer address, for example). A virtual address
  999. which fails permission checking is returned as status data in ret2. Some
  1000. CCBs may have been enqueued prior to the error being detected.
  1001. EUNAVAILABLE The requested CCB operation could not be performed at this time. The
  1002. restricted operation availability may apply only to the first unsuccessfully
  1003. submitted CCB, or may apply to a larger scope. The status should not be
  1004. interpreted as permanent, and the guest should attempt to submit CCBs in
  1005. the future which had previously been unable to be performed. The status
  1006. data provides additional information about scope of the retricted availability
  1007. as follows:
  1008. Value Description
  1009. 0 Processing for the exact CCB instance submitted was unavailable,
  1010. and it is recommended the guest emulate the operation. The
  1011. guest should continue to submit all other CCBs, and assume no
  1012. restrictions beyond this exact CCB instance.
  1013. 1 Processing is unavailable for all CCBs using the requested opcode,
  1014. and it is recommended the guest emulate the operation. The
  1015. guest should continue to submit all other CCBs that use different
  1016. opcodes, but can expect continued rejections of CCBs using the
  1017. same opcode in the near future.
  1018. 531
  1019. Coprocessor services
  1020. Value Description
  1021. 2 Processing is unavailable for all CCBs using the requested CCB
  1022. version, and it is recommended the guest emulate the operation.
  1023. The guest should continue to submit all other CCBs that use
  1024. different CCB versions, but can expect continued rejections of
  1025. CCBs using the same CCB version in the near future.
  1026. 3 Processing is unavailable for all CCBs on the submitting vcpu,
  1027. and it is recommended the guest emulate the operation or resubmit
  1028. the CCB on a different vcpu. The guest should continue to submit
  1029. CCBs on all other vcpus but can expect continued rejections of all
  1030. CCBs on this vcpu in the near future.
  1031. 4 Processing is unavailable for all CCBs, and it is recommended
  1032. the guest emulate the operation. The guest should expect all CCB
  1033. submissions to be similarly rejected in the near future.
  1034. 36.3.2. ccb_info
  1035. trap# FAST_TRAP
  1036. function# CCB_INFO
  1037. arg0 address
  1038. ret0 status
  1039. ret1 CCB state
  1040. ret2 position
  1041. ret3 dax
  1042. ret4 queue
  1043. Requests status information on a previously submitted CCB. The previously submitted CCB is identified
  1044. by the 64-byte aligned real address of the CCBs completion area.
  1045. A CCB can be in one of 4 states:
  1046. State Value Description
  1047. COMPLETED 0 The CCB has been fetched and executed, and is no longer active in
  1048. the virtual machine.
  1049. ENQUEUED 1 The requested CCB is current in a queue awaiting execution.
  1050. INPROGRESS 2 The CCB has been fetched and is currently being executed. It may still
  1051. be possible to stop the execution using the ccb_kill hypercall.
  1052. NOTFOUND 3 The CCB could not be located in the virtual machine, and does not
  1053. appear to have been executed. This may occur if the CCB was lost
  1054. due to a hardware error, or the CCB may not have been successfully
  1055. submitted to the virtual machine in the first place.
  1056. Implementation note
  1057. Some platforms may not be able to report CCBs that are currently being processed, and therefore
  1058. guest software should invoke the ccb_kill hypercall prior to assuming the request CCB will never
  1059. be executed because it was in the NOTFOUND state.
  1060. 532
  1061. Coprocessor services
  1062. The position return value is only valid when the state is ENQUEUED. The value returned is the number
  1063. of other CCBs ahead of the requested CCB, to provide a relative estimate of when the CCB may execute.
  1064. The dax return value is only valid when the state is ENQUEUED. The value returned is the DAX unit
  1065. instance indentifier for the DAX unit processing the queue where the requested CCB is located. The value
  1066. matches the value that would have been, or was, returned by ccb_submit using the queue info flag.
  1067. The queue return value is only valid when the state is ENQUEUED. The value returned is the DAX
  1068. queue instance indentifier for the DAX unit processing the queue where the requested CCB is located. The
  1069. value matches the value that would have been, or was, returned by ccb_submit using the queue info flag.
  1070. 36.3.2.1. Errors
  1071. EOK The request was proccessed and the CCB state is valid.
  1072. EBADALIGN address is not on a 64-byte aligned.
  1073. ENORADDR The real address provided for address is not valid.
  1074. EINVAL The CCB completion area contents are not valid.
  1075. EWOULDBLOCK Internal resource contraints prevented the CCB state from being queried at this
  1076. time. The guest should retry the request.
  1077. ENOACCESS The guest does not have permission to access the coprocessor virtual device
  1078. functionality.
  1079. 36.3.3. ccb_kill
  1080. trap# FAST_TRAP
  1081. function# CCB_KILL
  1082. arg0 address
  1083. ret0 status
  1084. ret1 result
  1085. Request to stop execution of a previously submitted CCB. The previously submitted CCB is identified by
  1086. the 64-byte aligned real address of the CCBs completion area.
  1087. The kill attempt can produce one of several values in the result return value, reflecting the CCB state
  1088. and actions taken by the Hypervisor:
  1089. Result Value Description
  1090. COMPLETED 0 The CCB has been fetched and executed, and is no longer active in
  1091. the virtual machine. It could not be killed and no action was taken.
  1092. DEQUEUED 1 The requested CCB was still enqueued when the kill request was
  1093. submitted, and has been removed from the queue. Since the CCB
  1094. never began execution, no memory modifications were produced by
  1095. it, and the completion area will never be updated. The same CCB may
  1096. be submitted again, if desired, with no modifications required.
  1097. KILLED 2 The CCB had been fetched and was being executed when the kill
  1098. request was submitted. The CCB execution was stopped, and the CCB
  1099. is no longer active in the virtual machine. The CCB completion area
  1100. will reflect the killed status, with the subsequent implications that
  1101. partial results may have been produced. Partial results may include full
  1102. 533
  1103. Coprocessor services
  1104. Result Value Description
  1105. command execution if the command was stopped just prior to writing
  1106. to the completion area.
  1107. NOTFOUND 3 The CCB could not be located in the virtual machine, and does not
  1108. appear to have been executed. This may occur if the CCB was lost
  1109. due to a hardware error, or the CCB may not have been successfully
  1110. submitted to the virtual machine in the first place. CCBs in the state
  1111. are guaranteed to never execute in the future unless resubmitted.
  1112. 36.3.3.1. Interactions with Pipelined CCBs
  1113. If the pipeline target CCB is killed but the pipeline source CCB was skipped, the completion area of the
  1114. target CCB may contain status (4,0) "Command was skipped" instead of (3,7) "Command was killed".
  1115. If the pipeline source CCB is killed, the pipeline target CCB's completion status may read (1,0) "Success".
  1116. This does not mean the target CCB was processed; since the source CCB was killed, there was no
  1117. meaningful output on which the target CCB could operate.
  1118. 36.3.3.2. Errors
  1119. EOK The request was proccessed and the result is valid.
  1120. EBADALIGN address is not on a 64-byte aligned.
  1121. ENORADDR The real address provided for address is not valid.
  1122. EINVAL The CCB completion area contents are not valid.
  1123. EWOULDBLOCK Internal resource contraints prevented the CCB from being killed at this time.
  1124. The guest should retry the request.
  1125. ENOACCESS The guest does not have permission to access the coprocessor virtual device
  1126. functionality.
  1127. 36.3.4. dax_info
  1128. trap# FAST_TRAP
  1129. function# DAX_INFO
  1130. ret0 status
  1131. ret1 Number of enabled DAX units
  1132. ret2 Number of disabled DAX units
  1133. Returns the number of DAX units that are enabled for the calling guest to submit CCBs. The number of
  1134. DAX units that are disabled for the calling guest are also returned. A disabled DAX unit would have been
  1135. available for CCB submission to the calling guest had it not been offlined.
  1136. 36.3.4.1. Errors
  1137. EOK The request was proccessed and the number of enabled/disabled DAX units
  1138. are valid.
  1139. 534