2
* Freescale hypervisor ioctl and kernel interface
4
* Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
5
* Author: Timur Tabi <timur@freescale.com>
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.
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
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.
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.
40
#ifndef FSL_HYPERVISOR_H
41
#define FSL_HYPERVISOR_H
43
#include <linux/types.h>
46
* struct fsl_hv_ioctl_restart - restart a partition
47
* @ret: return error code from the hypervisor
48
* @partition: the ID of the partition to restart, or -1 for the
51
* Used by FSL_HV_IOCTL_PARTITION_RESTART
53
struct fsl_hv_ioctl_restart {
59
* struct fsl_hv_ioctl_status - get a partition's status
60
* @ret: return error code from the hypervisor
61
* @partition: the ID of the partition to query, or -1 for the
63
* @status: The returned status of the partition
65
* Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
73
struct fsl_hv_ioctl_status {
80
* struct fsl_hv_ioctl_start - start a partition
81
* @ret: return error code from the hypervisor
82
* @partition: the ID of the partition to control
83
* @entry_point: The offset within the guest IMA to start execution
84
* @load: If non-zero, reload the partition's images before starting
86
* Used by FSL_HV_IOCTL_PARTITION_START
88
struct fsl_hv_ioctl_start {
96
* struct fsl_hv_ioctl_stop - stop a partition
97
* @ret: return error code from the hypervisor
98
* @partition: the ID of the partition to stop, or -1 for the calling
101
* Used by FSL_HV_IOCTL_PARTITION_STOP
103
struct fsl_hv_ioctl_stop {
109
* struct fsl_hv_ioctl_memcpy - copy memory between partitions
110
* @ret: return error code from the hypervisor
111
* @source: the partition ID of the source partition, or -1 for this
113
* @target: the partition ID of the target partition, or -1 for this
115
* @reserved: reserved, must be set to 0
116
* @local_addr: user-space virtual address of a buffer in the local
118
* @remote_addr: guest physical address of a buffer in the
120
* @count: the number of bytes to copy. Both the local and remote
121
* buffers must be at least 'count' bytes long
123
* Used by FSL_HV_IOCTL_MEMCPY
125
* The 'local' partition is the partition that calls this ioctl. The
126
* 'remote' partition is a different partition. The data is copied from
127
* the 'source' paritition' to the 'target' partition.
129
* The buffer in the remote partition must be guest physically
132
* This ioctl does not support copying memory between two remote
133
* partitions or within the same partition, so either 'source' or
134
* 'target' (but not both) must be -1. In other words, either
136
* source == local and target == remote
138
* source == remote and target == local
140
struct fsl_hv_ioctl_memcpy {
144
__u32 reserved; /* padding to ensure local_vaddr is aligned */
151
* struct fsl_hv_ioctl_doorbell - ring a doorbell
152
* @ret: return error code from the hypervisor
153
* @doorbell: the handle of the doorbell to ring doorbell
155
* Used by FSL_HV_IOCTL_DOORBELL
157
struct fsl_hv_ioctl_doorbell {
163
* struct fsl_hv_ioctl_prop - get/set a device tree property
164
* @ret: return error code from the hypervisor
165
* @handle: handle of partition whose tree to access
166
* @path: virtual address of path name of node to access
167
* @propname: virtual address of name of property to access
168
* @propval: virtual address of property data buffer
169
* @proplen: Size of property data buffer
170
* @reserved: reserved, must be set to 0
172
* Used by FSL_HV_IOCTL_DOORBELL
174
struct fsl_hv_ioctl_prop {
181
__u32 reserved; /* padding to ensure structure is aligned */
184
/* The ioctl type, documented in ioctl-number.txt */
185
#define FSL_HV_IOCTL_TYPE 0xAF
187
/* Restart another partition */
188
#define FSL_HV_IOCTL_PARTITION_RESTART \
189
_IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart)
191
/* Get a partition's status */
192
#define FSL_HV_IOCTL_PARTITION_GET_STATUS \
193
_IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status)
195
/* Boot another partition */
196
#define FSL_HV_IOCTL_PARTITION_START \
197
_IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start)
199
/* Stop this or another partition */
200
#define FSL_HV_IOCTL_PARTITION_STOP \
201
_IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop)
203
/* Copy data from one partition to another */
204
#define FSL_HV_IOCTL_MEMCPY \
205
_IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy)
207
/* Ring a doorbell */
208
#define FSL_HV_IOCTL_DOORBELL \
209
_IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell)
211
/* Get a property from another guest's device tree */
212
#define FSL_HV_IOCTL_GETPROP \
213
_IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop)
215
/* Set a property in another guest's device tree */
216
#define FSL_HV_IOCTL_SETPROP \
217
_IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop)
222
* fsl_hv_event_register() - register a callback for failover events
223
* @nb: pointer to caller-supplied notifier_block structure
225
* This function is called by device drivers to register their callback
226
* functions for fail-over events.
228
* The caller should allocate a notifier_block object and initialize the
229
* 'priority' and 'notifier_call' fields.
231
int fsl_hv_failover_register(struct notifier_block *nb);
234
* fsl_hv_event_unregister() - unregister a callback for failover events
235
* @nb: the same 'nb' used in previous fsl_hv_failover_register call
237
int fsl_hv_failover_unregister(struct notifier_block *nb);