mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
implement iommu_group
Signed-off-by: Pascal Bauer <pascal.bauer@rwth-aachen.de>
This commit is contained in:
parent
c4d414c2af
commit
d43caed903
2 changed files with 4 additions and 5 deletions
|
@ -72,12 +72,11 @@ public:
|
|||
|
||||
// Implement device interface
|
||||
std::optional<std::unique_ptr<Driver>> driver() const override;
|
||||
std::optional<int> iommu_group() const override;
|
||||
|
||||
// Bind a new LKM to the PCI device
|
||||
bool attachDriver(const std::string &driver) const;
|
||||
|
||||
// Return the IOMMU group of this PCI device or -1 if the device is not in a group
|
||||
int getIommuGroup() const;
|
||||
|
||||
std::list<Region> getRegions() const;
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ void PciDevice::writeBar(uint32_t addr, unsigned barNum) {
|
|||
file.write(reinterpret_cast<char *>(&addr), sizeof(addr));
|
||||
}
|
||||
|
||||
int PciDevice::getIommuGroup() const {
|
||||
std::optional<int> PciDevice::iommu_group() const {
|
||||
int ret;
|
||||
char *group;
|
||||
|
||||
|
@ -439,11 +439,11 @@ int PciDevice::getIommuGroup() const {
|
|||
|
||||
ret = readlink(sysfs, link, sizeof(link));
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
return std::nullopt;
|
||||
|
||||
group = basename(link);
|
||||
|
||||
return atoi(group);
|
||||
return std::make_optional(atoi(group));
|
||||
}
|
||||
|
||||
std::fstream PciDevice::openSysFs(const std::string &subPath,
|
||||
|
|
Loading…
Add table
Reference in a new issue