mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-20 13:11:34 +08:00
Linux: pass adapter BDF to GmmLib
Resolves: NEO-5785 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
dfb935fdcf
commit
1823054e08
@ -18,13 +18,15 @@ namespace NEO {
|
||||
extern GMM_INIT_IN_ARGS passedInputArgs;
|
||||
extern bool copyInputArgs;
|
||||
|
||||
TEST(OsInterfaceTest, whenOsInterfaceSetupsGmmInputArgsThenProperFileDescriptorIsSet) {
|
||||
TEST(OsInterfaceTest, whenOsInterfaceSetupsGmmInputArgsThenFileDescriptorIsSetWithValueOfAdapterBdf) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[0].get();
|
||||
auto osInterface = new OSInterface();
|
||||
rootDeviceEnvironment->osInterface.reset(osInterface);
|
||||
|
||||
auto drm = new DrmMock(fakeFd, *rootDeviceEnvironment);
|
||||
drm->setPciPath("01:23.4");
|
||||
|
||||
osInterface->get()->setDrm(drm);
|
||||
|
||||
GMM_INIT_IN_ARGS gmmInputArgs = {};
|
||||
@ -32,8 +34,11 @@ TEST(OsInterfaceTest, whenOsInterfaceSetupsGmmInputArgsThenProperFileDescriptorI
|
||||
osInterface->setGmmInputArgs(&gmmInputArgs);
|
||||
EXPECT_NE(0u, gmmInputArgs.FileDescriptor);
|
||||
|
||||
auto expectedFileDescriptor = drm->getFileDescriptor();
|
||||
EXPECT_EQ(static_cast<uint32_t>(expectedFileDescriptor), gmmInputArgs.FileDescriptor);
|
||||
ADAPTER_BDF expectedAdapterBDF{};
|
||||
expectedAdapterBDF.Bus = 0x1;
|
||||
expectedAdapterBDF.Device = 0x23;
|
||||
expectedAdapterBDF.Function = 0x4;
|
||||
EXPECT_EQ(expectedAdapterBDF.Data, gmmInputArgs.FileDescriptor);
|
||||
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, gmmInputArgs.ClientType);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,28 @@ TEST(DrmTest, WhenGettingDeviceIdThenCorrectIdReturned) {
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenValidPciPathWhenGettingAdapterBdfThenCorrectValuesAreReturned) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
|
||||
{
|
||||
drm.setPciPath("ab:cd.e");
|
||||
auto adapterBdf = drm.getAdapterBDF();
|
||||
EXPECT_EQ(0xabu, adapterBdf.Bus);
|
||||
EXPECT_EQ(0xcdu, adapterBdf.Device);
|
||||
EXPECT_EQ(0xeu, adapterBdf.Function);
|
||||
}
|
||||
|
||||
{
|
||||
drm.setPciPath("01:23.4");
|
||||
auto adapterBdf = drm.getAdapterBDF();
|
||||
EXPECT_EQ(0x1u, adapterBdf.Bus);
|
||||
EXPECT_EQ(0x23u, adapterBdf.Device);
|
||||
EXPECT_EQ(0x4u, adapterBdf.Function);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenInvalidPciPathWhenFrequencyIsQueriedThenReturnError) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
|
Reference in New Issue
Block a user