Source
x
/* Returns the next head/tail pointer, wrapping around the queue if necessary */
/*
* Freescale Hypervisor Management Driver
* Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
* Author: Timur Tabi <timur@freescale.com>
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*
* The Freescale hypervisor management driver provides several services to
* drivers and applications related to the Freescale hypervisor:
*
* 1. An ioctl interface for querying and managing partitions.
*
* 2. A file interface to reading incoming doorbells.
*
* 3. An interrupt handler for shutting down the partition upon receiving the
* shutdown doorbell from a manager partition.
*
* 4. A kernel interface for receiving callbacks when a managed partition
* shuts down.
*/
static BLOCKING_NOTIFIER_HEAD(failover_subscribers);
/*
* Ioctl interface for FSL_HV_IOCTL_PARTITION_RESTART
*
* Restart a running partition
*/
static long ioctl_restart(struct fsl_hv_ioctl_restart __user *p)
{
struct fsl_hv_ioctl_restart param;
/* Get the parameters from the user */
if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_restart)))
return -EFAULT;
param.ret = fh_partition_restart(param.partition);
if (copy_to_user(&p->ret, ¶m.ret, sizeof(__u32)))
return -EFAULT;
return 0;
}
/*
* Ioctl interface for FSL_HV_IOCTL_PARTITION_STATUS
*
* Query the status of a partition
*/
static long ioctl_status(struct fsl_hv_ioctl_status __user *p)
{
struct fsl_hv_ioctl_status param;
u32 status;
/* Get the parameters from the user */
if (copy_from_user(¶m, p, sizeof(struct fsl_hv_ioctl_status)))
return -EFAULT;
param.ret = fh_partition_get_status(param.partition, &status);
if (!param.ret)
param.status = status;
if (copy_to_user(p, ¶m, sizeof(struct fsl_hv_ioctl_status)))
return -EFAULT;
return 0;