Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
0002 /*
0003  * Freescale hypervisor ioctl and kernel interface
0004  *
0005  * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
0006  * Author: Timur Tabi <timur@freescale.com>
0007  *
0008  * Redistribution and use in source and binary forms, with or without
0009  * modification, are permitted provided that the following conditions are met:
0010  *     * Redistributions of source code must retain the above copyright
0011  *       notice, this list of conditions and the following disclaimer.
0012  *     * Redistributions in binary form must reproduce the above copyright
0013  *       notice, this list of conditions and the following disclaimer in the
0014  *       documentation and/or other materials provided with the distribution.
0015  *     * Neither the name of Freescale Semiconductor nor the
0016  *       names of its contributors may be used to endorse or promote products
0017  *       derived from this software without specific prior written permission.
0018  *
0019  *
0020  * ALTERNATIVELY, this software may be distributed under the terms of the
0021  * GNU General Public License ("GPL") as published by the Free Software
0022  * Foundation, either version 2 of that License or (at your option) any
0023  * later version.
0024  *
0025  * This software is provided by Freescale Semiconductor "as is" and any
0026  * express or implied warranties, including, but not limited to, the implied
0027  * warranties of merchantability and fitness for a particular purpose are
0028  * disclaimed. In no event shall Freescale Semiconductor be liable for any
0029  * direct, indirect, incidental, special, exemplary, or consequential damages
0030  * (including, but not limited to, procurement of substitute goods or services;
0031  * loss of use, data, or profits; or business interruption) however caused and
0032  * on any theory of liability, whether in contract, strict liability, or tort
0033  * (including negligence or otherwise) arising in any way out of the use of this
0034  * software, even if advised of the possibility of such damage.
0035  *
0036  * This file is used by the Freescale hypervisor management driver.  It can
0037  * also be included by applications that need to communicate with the driver
0038  * via the ioctl interface.
0039  */
0040 
0041 #ifndef _UAPIFSL_HYPERVISOR_H
0042 #define _UAPIFSL_HYPERVISOR_H
0043 
0044 #include <linux/types.h>
0045 
0046 /**
0047  * struct fsl_hv_ioctl_restart - restart a partition
0048  * @ret: return error code from the hypervisor
0049  * @partition: the ID of the partition to restart, or -1 for the
0050  *             calling partition
0051  *
0052  * Used by FSL_HV_IOCTL_PARTITION_RESTART
0053  */
0054 struct fsl_hv_ioctl_restart {
0055     __u32 ret;
0056     __u32 partition;
0057 };
0058 
0059 /**
0060  * struct fsl_hv_ioctl_status - get a partition's status
0061  * @ret: return error code from the hypervisor
0062  * @partition: the ID of the partition to query, or -1 for the
0063  *             calling partition
0064  * @status: The returned status of the partition
0065  *
0066  * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
0067  *
0068  * Values of 'status':
0069  *    0 = Stopped
0070  *    1 = Running
0071  *    2 = Starting
0072  *    3 = Stopping
0073  */
0074 struct fsl_hv_ioctl_status {
0075     __u32 ret;
0076     __u32 partition;
0077     __u32 status;
0078 };
0079 
0080 /**
0081  * struct fsl_hv_ioctl_start - start a partition
0082  * @ret: return error code from the hypervisor
0083  * @partition: the ID of the partition to control
0084  * @entry_point: The offset within the guest IMA to start execution
0085  * @load: If non-zero, reload the partition's images before starting
0086  *
0087  * Used by FSL_HV_IOCTL_PARTITION_START
0088  */
0089 struct fsl_hv_ioctl_start {
0090     __u32 ret;
0091     __u32 partition;
0092     __u32 entry_point;
0093     __u32 load;
0094 };
0095 
0096 /**
0097  * struct fsl_hv_ioctl_stop - stop a partition
0098  * @ret: return error code from the hypervisor
0099  * @partition: the ID of the partition to stop, or -1 for the calling
0100  *             partition
0101  *
0102  * Used by FSL_HV_IOCTL_PARTITION_STOP
0103  */
0104 struct fsl_hv_ioctl_stop {
0105     __u32 ret;
0106     __u32 partition;
0107 };
0108 
0109 /**
0110  * struct fsl_hv_ioctl_memcpy - copy memory between partitions
0111  * @ret: return error code from the hypervisor
0112  * @source: the partition ID of the source partition, or -1 for this
0113  *          partition
0114  * @target: the partition ID of the target partition, or -1 for this
0115  *          partition
0116  * @reserved: reserved, must be set to 0
0117  * @local_addr: user-space virtual address of a buffer in the local
0118  *              partition
0119  * @remote_addr: guest physical address of a buffer in the
0120  *           remote partition
0121  * @count: the number of bytes to copy.  Both the local and remote
0122  *         buffers must be at least 'count' bytes long
0123  *
0124  * Used by FSL_HV_IOCTL_MEMCPY
0125  *
0126  * The 'local' partition is the partition that calls this ioctl.  The
0127  * 'remote' partition is a different partition.  The data is copied from
0128  * the 'source' paritition' to the 'target' partition.
0129  *
0130  * The buffer in the remote partition must be guest physically
0131  * contiguous.
0132  *
0133  * This ioctl does not support copying memory between two remote
0134  * partitions or within the same partition, so either 'source' or
0135  * 'target' (but not both) must be -1.  In other words, either
0136  *
0137  *      source == local and target == remote
0138  * or
0139  *      source == remote and target == local
0140  */
0141 struct fsl_hv_ioctl_memcpy {
0142     __u32 ret;
0143     __u32 source;
0144     __u32 target;
0145     __u32 reserved; /* padding to ensure local_vaddr is aligned */
0146     __u64 local_vaddr;
0147     __u64 remote_paddr;
0148     __u64 count;
0149 };
0150 
0151 /**
0152  * struct fsl_hv_ioctl_doorbell - ring a doorbell
0153  * @ret: return error code from the hypervisor
0154  * @doorbell: the handle of the doorbell to ring doorbell
0155  *
0156  * Used by FSL_HV_IOCTL_DOORBELL
0157  */
0158 struct fsl_hv_ioctl_doorbell {
0159     __u32 ret;
0160     __u32 doorbell;
0161 };
0162 
0163 /**
0164  * struct fsl_hv_ioctl_prop - get/set a device tree property
0165  * @ret: return error code from the hypervisor
0166  * @handle: handle of partition whose tree to access
0167  * @path: virtual address of path name of node to access
0168  * @propname: virtual address of name of property to access
0169  * @propval: virtual address of property data buffer
0170  * @proplen: Size of property data buffer
0171  * @reserved: reserved, must be set to 0
0172  *
0173  * Used by FSL_HV_IOCTL_DOORBELL
0174  */
0175 struct fsl_hv_ioctl_prop {
0176     __u32 ret;
0177     __u32 handle;
0178     __u64 path;
0179     __u64 propname;
0180     __u64 propval;
0181     __u32 proplen;
0182     __u32 reserved; /* padding to ensure structure is aligned */
0183 };
0184 
0185 /* The ioctl type, documented in ioctl-number.txt */
0186 #define FSL_HV_IOCTL_TYPE   0xAF
0187 
0188 /* Restart another partition */
0189 #define FSL_HV_IOCTL_PARTITION_RESTART \
0190     _IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart)
0191 
0192 /* Get a partition's status */
0193 #define FSL_HV_IOCTL_PARTITION_GET_STATUS \
0194     _IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status)
0195 
0196 /* Boot another partition */
0197 #define FSL_HV_IOCTL_PARTITION_START \
0198     _IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start)
0199 
0200 /* Stop this or another partition */
0201 #define FSL_HV_IOCTL_PARTITION_STOP \
0202     _IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop)
0203 
0204 /* Copy data from one partition to another */
0205 #define FSL_HV_IOCTL_MEMCPY \
0206     _IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy)
0207 
0208 /* Ring a doorbell */
0209 #define FSL_HV_IOCTL_DOORBELL \
0210     _IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell)
0211 
0212 /* Get a property from another guest's device tree */
0213 #define FSL_HV_IOCTL_GETPROP \
0214     _IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop)
0215 
0216 /* Set a property in another guest's device tree */
0217 #define FSL_HV_IOCTL_SETPROP \
0218     _IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop)
0219 
0220 
0221 #endif /* _UAPIFSL_HYPERVISOR_H */