1 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
3 * Freescale hypervisor ioctl and kernel interface
5 * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
6 * Author: Timur Tabi <timur@freescale.com>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of Freescale Semiconductor nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
20 * ALTERNATIVELY, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") as published by the Free Software
22 * Foundation, either version 2 of that License or (at your option) any
25 * This software is provided by Freescale Semiconductor "as is" and any
26 * express or implied warranties, including, but not limited to, the implied
27 * warranties of merchantability and fitness for a particular purpose are
28 * disclaimed. In no event shall Freescale Semiconductor be liable for any
29 * direct, indirect, incidental, special, exemplary, or consequential damages
30 * (including, but not limited to, procurement of substitute goods or services;
31 * loss of use, data, or profits; or business interruption) however caused and
32 * on any theory of liability, whether in contract, strict liability, or tort
33 * (including negligence or otherwise) arising in any way out of the use of this
34 * software, even if advised of the possibility of such damage.
36 * This file is used by the Freescale hypervisor management driver. It can
37 * also be included by applications that need to communicate with the driver
38 * via the ioctl interface.
41 #ifndef _UAPIFSL_HYPERVISOR_H
42 #define _UAPIFSL_HYPERVISOR_H
44 #include <linux/types.h>
47 * struct fsl_hv_ioctl_restart - restart a partition
48 * @ret: return error code from the hypervisor
49 * @partition: the ID of the partition to restart, or -1 for the
52 * Used by FSL_HV_IOCTL_PARTITION_RESTART
54 struct fsl_hv_ioctl_restart {
60 * struct fsl_hv_ioctl_status - get a partition's status
61 * @ret: return error code from the hypervisor
62 * @partition: the ID of the partition to query, or -1 for the
64 * @status: The returned status of the partition
66 * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
74 struct fsl_hv_ioctl_status {
81 * struct fsl_hv_ioctl_start - start a partition
82 * @ret: return error code from the hypervisor
83 * @partition: the ID of the partition to control
84 * @entry_point: The offset within the guest IMA to start execution
85 * @load: If non-zero, reload the partition's images before starting
87 * Used by FSL_HV_IOCTL_PARTITION_START
89 struct fsl_hv_ioctl_start {
97 * struct fsl_hv_ioctl_stop - stop a partition
98 * @ret: return error code from the hypervisor
99 * @partition: the ID of the partition to stop, or -1 for the calling
102 * Used by FSL_HV_IOCTL_PARTITION_STOP
104 struct fsl_hv_ioctl_stop {
110 * struct fsl_hv_ioctl_memcpy - copy memory between partitions
111 * @ret: return error code from the hypervisor
112 * @source: the partition ID of the source partition, or -1 for this
114 * @target: the partition ID of the target partition, or -1 for this
116 * @reserved: reserved, must be set to 0
117 * @local_addr: user-space virtual address of a buffer in the local
119 * @remote_addr: guest physical address of a buffer in the
121 * @count: the number of bytes to copy. Both the local and remote
122 * buffers must be at least 'count' bytes long
124 * Used by FSL_HV_IOCTL_MEMCPY
126 * The 'local' partition is the partition that calls this ioctl. The
127 * 'remote' partition is a different partition. The data is copied from
128 * the 'source' paritition' to the 'target' partition.
130 * The buffer in the remote partition must be guest physically
133 * This ioctl does not support copying memory between two remote
134 * partitions or within the same partition, so either 'source' or
135 * 'target' (but not both) must be -1. In other words, either
137 * source == local and target == remote
139 * source == remote and target == local
141 struct fsl_hv_ioctl_memcpy {
145 __u32 reserved; /* padding to ensure local_vaddr is aligned */
152 * struct fsl_hv_ioctl_doorbell - ring a doorbell
153 * @ret: return error code from the hypervisor
154 * @doorbell: the handle of the doorbell to ring doorbell
156 * Used by FSL_HV_IOCTL_DOORBELL
158 struct fsl_hv_ioctl_doorbell {
164 * struct fsl_hv_ioctl_prop - get/set a device tree property
165 * @ret: return error code from the hypervisor
166 * @handle: handle of partition whose tree to access
167 * @path: virtual address of path name of node to access
168 * @propname: virtual address of name of property to access
169 * @propval: virtual address of property data buffer
170 * @proplen: Size of property data buffer
171 * @reserved: reserved, must be set to 0
173 * Used by FSL_HV_IOCTL_DOORBELL
175 struct fsl_hv_ioctl_prop {
182 __u32 reserved; /* padding to ensure structure is aligned */
185 /* The ioctl type, documented in ioctl-number.txt */
186 #define FSL_HV_IOCTL_TYPE 0xAF
188 /* Restart another partition */
189 #define FSL_HV_IOCTL_PARTITION_RESTART \
190 _IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart)
192 /* Get a partition's status */
193 #define FSL_HV_IOCTL_PARTITION_GET_STATUS \
194 _IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status)
196 /* Boot another partition */
197 #define FSL_HV_IOCTL_PARTITION_START \
198 _IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start)
200 /* Stop this or another partition */
201 #define FSL_HV_IOCTL_PARTITION_STOP \
202 _IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop)
204 /* Copy data from one partition to another */
205 #define FSL_HV_IOCTL_MEMCPY \
206 _IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy)
208 /* Ring a doorbell */
209 #define FSL_HV_IOCTL_DOORBELL \
210 _IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell)
212 /* Get a property from another guest's device tree */
213 #define FSL_HV_IOCTL_GETPROP \
214 _IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop)
216 /* Set a property in another guest's device tree */
217 #define FSL_HV_IOCTL_SETPROP \
218 _IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop)
221 #endif /* _UAPIFSL_HYPERVISOR_H */