1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

vfio: fix hot reset using the wron fd

Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
Niklas Eiling 2022-12-02 16:26:48 +01:00 committed by Steffen Vogel
parent 579faa459a
commit 2f6f0d31a1
2 changed files with 3 additions and 6 deletions

View file

@ -81,6 +81,7 @@ private:
int fd;
bool attachedToGroup;
int groupFd;
struct vfio_device_info info;

View file

@ -56,6 +56,7 @@ Device::Device(const std::string &name, int groupFileDescriptor, const kernel::p
name(name),
fd(-1),
attachedToGroup(false),
groupFd(groupFileDescriptor),
info(),
irqs(),
regions(),
@ -434,11 +435,6 @@ bool Device::pciHotReset()
log->debug(" {:04x}:{:02x}:{:02x}.{:01x}: iommu_group={}",
dd->segment, dd->bus,
PCI_SLOT(dd->devfn), PCI_FUNC(dd->devfn), dd->group_id);
/*if (static_cast<int>(dd->group_id) != index) {
delete[] reset_info_buf;
return false;
}*/
}
delete[] reset_info_buf;
@ -453,7 +449,7 @@ bool Device::pciHotReset()
reset->argsz = reset_len;
reset->count = 1;
reset->group_fds[0] = fd;
reset->group_fds[0] = groupFd;
int ret = ioctl(fd, VFIO_DEVICE_PCI_HOT_RESET, reset);
const bool success = (ret == 0);