/* * VFIO core * * Copyright (C) 2012 Red Hat, Inc. All rights reserved. * Author: Alex Williamson <alex.williamson@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Derived from original vfio: * Copyright 2010 Cisco Systems, Inc. All rights reserved. * Author: Tom Lyon, pugs@cisco.com */#include<linux/cdev.h>#include<linux/compat.h>#include<linux/device.h>#include<linux/file.h>#include<linux/anon_inodes.h>#include<linux/fs.h>#include<linux/idr.h>#include<linux/iommu.h>#include<linux/list.h>#include<linux/module.h>#include<linux/mutex.h>#include<linux/sched.h>#include<linux/slab.h>#include<linux/string.h>#include<linux/uaccess.h>#include<linux/vfio.h>#include<linux/wait.h>#define DRIVER_VERSION "0.3"#define DRIVER_AUTHOR "Alex Williamson <alex.williamson@redhat.com>"#define DRIVER_DESC "VFIO - User Level meta-driver"staticstructvfio{structclass*class;structlist_headiommu_drivers_list;structmutexiommu_drivers_lock;structlist_headgroup_list;structidrgroup_idr;structmutexgroup_lock;structcdevgroup_cdev;structdevice*dev;dev_tdevt;structcdevcdev;wait_queue_head_trelease_q;}vfio;structvfio_iommu_driver{conststructvfio_iommu_driver_ops*ops;structlist_headvfio_next;};structvfio_container{structkrefkref;structlist_headgroup_list;structmutexgroup_lock;structvfio_iommu_driver*iommu_driver;void*iommu_data;};structvfio_group{structkrefkref;intminor;atomic_tcontainer_users;structiommu_group*