Add new debug flags for filtering devices to open

FilterBdfPath is used only on Linux as a filter for BDF
when opening from /dev/dri/by-path

FilterDeviceId is used on both OSes as a filter for device id

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-01-31 17:43:42 +00:00
committed by Compute-Runtime-Automation
parent 36f8f67f20
commit 1671e0a1a7
11 changed files with 127 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -206,4 +206,12 @@ bool (*DeviceFactory::createMemoryManagerFunc)(ExecutionEnvironment &) = [](Exec
return executionEnvironment.initializeMemoryManager();
};
bool DeviceFactory::isAllowedDeviceId(uint32_t deviceId, const std::string &deviceIdString) {
if (deviceIdString != "unk") {
char *endptr = nullptr;
auto reqDeviceId = strtoul(deviceIdString.c_str(), &endptr, 16);
return (static_cast<uint32_t>(reqDeviceId) == deviceId);
}
return true;
}
} // namespace NEO