/** Virtual Function IO wrapper around kernel API * * @file * @author Niklas Eiling * @author Steffen Vogel * @author Daniel Krebs * @copyright 2022, Niklas Eiling * @copyright 2014-2021, Steffen Vogel * @copyright 2018, Daniel Krebs *********************************************************************************/ #pragma once #include #include #include #include #include #include #include namespace villas { namespace kernel { namespace vfio { class Group { public: Group(int index, bool iommuEnabled); ~Group(); void setAttachedToContainer() { attachedToContainer = true; }; bool isAttachedToContainer() { return attachedToContainer; }; int getFileDescriptor() { return fd; }; int getIndex() { return index; }; std::shared_ptr attachDevice(std::shared_ptr device); std::shared_ptr attachDevice(const std::string& name, const kernel::pci::Device *pci_device = nullptr); bool checkStatus(); void dump(); private: /// VFIO group file descriptor int fd; /// Index of the IOMMU group as listed under /sys/kernel/iommu_groups/ int index; bool attachedToContainer; /// Status of group struct vfio_group_status status; /// All devices owned by this group std::list> devices; Logger log; }; } /* namespace vfio */ } /* namespace kernel */ } /* namespace villas */