ueventd: Fix creation of VFIO dev nodes

VFIO nodes, both the container (`vfio`) node and group (numbered)
nodes, should be located in `/dev/vfio`. This change prevents
ueventd from flattening that structure.

Test: Bind a device to VFIO driver to create a VFIO group
Change-Id: I635e9febe6bb52718df263e735479f361eacad4c
This commit is contained in:
Jakob Vukalovic 2023-07-11 10:28:53 +01:00
parent 4a33c22c77
commit e377432924
2 changed files with 8 additions and 0 deletions

View file

@ -568,6 +568,8 @@ void DeviceHandler::HandleUevent(const Uevent& uevent) {
return;
} else if (uevent.subsystem == "misc" && StartsWith(uevent.device_name, "dm-user/")) {
devpath = "/dev/dm-user/" + uevent.device_name.substr(8);
} else if (uevent.subsystem == "misc" && uevent.device_name == "vfio/vfio") {
devpath = "/dev/" + uevent.device_name;
} else {
devpath = "/dev/" + Basename(uevent.path);
}

View file

@ -23,6 +23,11 @@ subsystem sound
subsystem dma_heap
devname uevent_devpath
dirname /dev/dma_heap
subsystem vfio
devname uevent_devpath
dirname /dev/vfio
# ueventd can only set permissions on device nodes and their associated
# sysfs attributes, not on arbitrary paths.
#
@ -43,6 +48,7 @@ subsystem dma_heap
/dev/binder 0666 root root
/dev/hwbinder 0666 root root
/dev/vndbinder 0666 root root
/dev/vfio/* 0666 root root
/dev/pmsg0 0222 root log
/dev/dma_heap/system 0444 system system