fsl_hypervisor.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Freescale hypervisor ioctl and kernel interface
  3. *
  4. * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
  5. * Author: Timur Tabi <timur@freescale.com>
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. * * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * * Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * * Neither the name of Freescale Semiconductor nor the
  15. * names of its contributors may be used to endorse or promote products
  16. * derived from this software without specific prior written permission.
  17. *
  18. *
  19. * ALTERNATIVELY, this software may be distributed under the terms of the
  20. * GNU General Public License ("GPL") as published by the Free Software
  21. * Foundation, either version 2 of that License or (at your option) any
  22. * later version.
  23. *
  24. * This software is provided by Freescale Semiconductor "as is" and any
  25. * express or implied warranties, including, but not limited to, the implied
  26. * warranties of merchantability and fitness for a particular purpose are
  27. * disclaimed. In no event shall Freescale Semiconductor be liable for any
  28. * direct, indirect, incidental, special, exemplary, or consequential damages
  29. * (including, but not limited to, procurement of substitute goods or services;
  30. * loss of use, data, or profits; or business interruption) however caused and
  31. * on any theory of liability, whether in contract, strict liability, or tort
  32. * (including negligence or otherwise) arising in any way out of the use of this
  33. * software, even if advised of the possibility of such damage.
  34. *
  35. * This file is used by the Freescale hypervisor management driver. It can
  36. * also be included by applications that need to communicate with the driver
  37. * via the ioctl interface.
  38. */
  39. #ifndef _UAPIFSL_HYPERVISOR_H
  40. #define _UAPIFSL_HYPERVISOR_H
  41. #include <linux/types.h>
  42. /**
  43. * struct fsl_hv_ioctl_restart - restart a partition
  44. * @ret: return error code from the hypervisor
  45. * @partition: the ID of the partition to restart, or -1 for the
  46. * calling partition
  47. *
  48. * Used by FSL_HV_IOCTL_PARTITION_RESTART
  49. */
  50. struct fsl_hv_ioctl_restart {
  51. __u32 ret;
  52. __u32 partition;
  53. };
  54. /**
  55. * struct fsl_hv_ioctl_status - get a partition's status
  56. * @ret: return error code from the hypervisor
  57. * @partition: the ID of the partition to query, or -1 for the
  58. * calling partition
  59. * @status: The returned status of the partition
  60. *
  61. * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
  62. *
  63. * Values of 'status':
  64. * 0 = Stopped
  65. * 1 = Running
  66. * 2 = Starting
  67. * 3 = Stopping
  68. */
  69. struct fsl_hv_ioctl_status {
  70. __u32 ret;
  71. __u32 partition;
  72. __u32 status;
  73. };
  74. /**
  75. * struct fsl_hv_ioctl_start - start a partition
  76. * @ret: return error code from the hypervisor
  77. * @partition: the ID of the partition to control
  78. * @entry_point: The offset within the guest IMA to start execution
  79. * @load: If non-zero, reload the partition's images before starting
  80. *
  81. * Used by FSL_HV_IOCTL_PARTITION_START
  82. */
  83. struct fsl_hv_ioctl_start {
  84. __u32 ret;
  85. __u32 partition;
  86. __u32 entry_point;
  87. __u32 load;
  88. };
  89. /**
  90. * struct fsl_hv_ioctl_stop - stop a partition
  91. * @ret: return error code from the hypervisor
  92. * @partition: the ID of the partition to stop, or -1 for the calling
  93. * partition
  94. *
  95. * Used by FSL_HV_IOCTL_PARTITION_STOP
  96. */
  97. struct fsl_hv_ioctl_stop {
  98. __u32 ret;
  99. __u32 partition;
  100. };
  101. /**
  102. * struct fsl_hv_ioctl_memcpy - copy memory between partitions
  103. * @ret: return error code from the hypervisor
  104. * @source: the partition ID of the source partition, or -1 for this
  105. * partition
  106. * @target: the partition ID of the target partition, or -1 for this
  107. * partition
  108. * @reserved: reserved, must be set to 0
  109. * @local_addr: user-space virtual address of a buffer in the local
  110. * partition
  111. * @remote_addr: guest physical address of a buffer in the
  112. * remote partition
  113. * @count: the number of bytes to copy. Both the local and remote
  114. * buffers must be at least 'count' bytes long
  115. *
  116. * Used by FSL_HV_IOCTL_MEMCPY
  117. *
  118. * The 'local' partition is the partition that calls this ioctl. The
  119. * 'remote' partition is a different partition. The data is copied from
  120. * the 'source' paritition' to the 'target' partition.
  121. *
  122. * The buffer in the remote partition must be guest physically
  123. * contiguous.
  124. *
  125. * This ioctl does not support copying memory between two remote
  126. * partitions or within the same partition, so either 'source' or
  127. * 'target' (but not both) must be -1. In other words, either
  128. *
  129. * source == local and target == remote
  130. * or
  131. * source == remote and target == local
  132. */
  133. struct fsl_hv_ioctl_memcpy {
  134. __u32 ret;
  135. __u32 source;
  136. __u32 target;
  137. __u32 reserved; /* padding to ensure local_vaddr is aligned */
  138. __u64 local_vaddr;
  139. __u64 remote_paddr;
  140. __u64 count;
  141. };
  142. /**
  143. * struct fsl_hv_ioctl_doorbell - ring a doorbell
  144. * @ret: return error code from the hypervisor
  145. * @doorbell: the handle of the doorbell to ring doorbell
  146. *
  147. * Used by FSL_HV_IOCTL_DOORBELL
  148. */
  149. struct fsl_hv_ioctl_doorbell {
  150. __u32 ret;
  151. __u32 doorbell;
  152. };
  153. /**
  154. * struct fsl_hv_ioctl_prop - get/set a device tree property
  155. * @ret: return error code from the hypervisor
  156. * @handle: handle of partition whose tree to access
  157. * @path: virtual address of path name of node to access
  158. * @propname: virtual address of name of property to access
  159. * @propval: virtual address of property data buffer
  160. * @proplen: Size of property data buffer
  161. * @reserved: reserved, must be set to 0
  162. *
  163. * Used by FSL_HV_IOCTL_DOORBELL
  164. */
  165. struct fsl_hv_ioctl_prop {
  166. __u32 ret;
  167. __u32 handle;
  168. __u64 path;
  169. __u64 propname;
  170. __u64 propval;
  171. __u32 proplen;
  172. __u32 reserved; /* padding to ensure structure is aligned */
  173. };
  174. /* The ioctl type, documented in ioctl-number.txt */
  175. #define FSL_HV_IOCTL_TYPE 0xAF
  176. /* Restart another partition */
  177. #define FSL_HV_IOCTL_PARTITION_RESTART \
  178. _IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart)
  179. /* Get a partition's status */
  180. #define FSL_HV_IOCTL_PARTITION_GET_STATUS \
  181. _IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status)
  182. /* Boot another partition */
  183. #define FSL_HV_IOCTL_PARTITION_START \
  184. _IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start)
  185. /* Stop this or another partition */
  186. #define FSL_HV_IOCTL_PARTITION_STOP \
  187. _IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop)
  188. /* Copy data from one partition to another */
  189. #define FSL_HV_IOCTL_MEMCPY \
  190. _IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy)
  191. /* Ring a doorbell */
  192. #define FSL_HV_IOCTL_DOORBELL \
  193. _IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell)
  194. /* Get a property from another guest's device tree */
  195. #define FSL_HV_IOCTL_GETPROP \
  196. _IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop)
  197. /* Set a property in another guest's device tree */
  198. #define FSL_HV_IOCTL_SETPROP \
  199. _IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop)
  200. #endif /* _UAPIFSL_HYPERVISOR_H */