• L
    qemu: add vfio devices to cgroup ACL when appropriate · 6e13860c
    Laine Stump 提交于
    PCIO device assignment using VFIO requires read/write access by the
    qemu process to /dev/vfio/vfio, and /dev/vfio/nn, where "nn" is the
    VFIO group number that the assigned device belongs to (and can be
    found with the function virPCIDeviceGetVFIOGroupDev)
    
    /dev/vfio/vfio can be accessible to any guest without danger
    (according to vfio developers), so it is added to the static ACL.
    
    The group device must be dynamically added to the cgroup ACL for each
    vfio hostdev in two places:
    
    1) for any devices in the persistent config when the domain is started
       (done during qemuSetupCgroup())
    
    2) at device attach time for any hotplug devices (done in
       qemuDomainAttachHostDevice)
    
    The group device must be removed from the ACL when a device it
    "hot-unplugged" (in qemuDomainDetachHostDevice())
    
    Note that USB devices are already doing their own cgroup setup and
    teardown in the hostdev-usb specific function. I chose to make the new
    functions generic and call them in a common location though. We can
    then move the USB-specific code (which is duplicated in two locations)
    to this single location. I'll be posting a followup patch to do that.
    6e13860c
test_libvirtd_qemu.aug.in 1.9 KB