Support maxBandwidth in zesDevicePciGetState for windows

Fix to update zes_pci_speed_t.maxBandwidth

Related-To: LOCI-4056

Signed-off-by: Kulkarni, Ashwin Kumar <ashwin.kumar.kulkarni@intel.com>
This commit is contained in:
Kulkarni, Ashwin Kumar
2023-03-06 06:05:12 +00:00
committed by Compute-Runtime-Automation
parent 2606788250
commit 9d866dac9e
3 changed files with 17 additions and 1 deletions

View File

@@ -148,6 +148,12 @@ ze_result_t WddmPciImp::getState(zes_pci_state_t *state) {
state->speed.width = static_cast<int32_t>(valueSmall);
}
double currentLinkSpeed = convertPciGenToLinkSpeed(state->speed.gen);
state->speed.maxBandwidth = state->speed.width * convertPcieSpeedFromGTsToBs(currentLinkSpeed);
if (state->speed.maxBandwidth == 0) {
state->speed.maxBandwidth = -1;
}
return ZE_RESULT_SUCCESS;
}

View File

@@ -31,6 +31,7 @@ struct Mock<PciKmdSysManager> : public PciKmdSysManager {
uint32_t mockMaxLinkWidth[3] = {1, 0, 8};
uint32_t mockCurrentLinkSpeed[3] = {1, 0, 3};
uint32_t mockCurrentLinkWidth[3] = {1, 0, 1};
int64_t mockCurrentMaxBandwidth[3] = {250000000, -1, 984615384};
uint32_t mockResizableBarSupported[3] = {1, 1, 1};
uint32_t mockResizableBarEnabled[3] = {1, 1, 1};
uint32_t pciBusReturnCode = KmdSysman::KmdSysmanSuccess;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -237,6 +237,15 @@ TEST_F(SysmanDevicePciFixture, GivenValidSysmanHandleWhenCallingzetSysmanPciGetS
EXPECT_EQ(state.speed.width, pKmdSysManager->mockCurrentLinkWidth[KmdSysman::PciDomainsType::PciCurrentDevice]);
}
TEST_F(SysmanDevicePciFixture, GivenValidSysmanHandleWhenCallingzetSysmanPciGetStateThenValidCurrentMaxBandwidthIsReturned) {
setLocalMemorySupportedAndReinit(true);
zes_pci_state_t state = {};
ze_result_t result = zesDevicePciGetState(device, &state);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(state.speed.maxBandwidth, pKmdSysManager->mockCurrentMaxBandwidth[KmdSysman::PciDomainsType::PciRootPort]);
}
TEST_F(SysmanDevicePciFixture, GivenValidSysmanHandleWhenCallingGetPciStateAndRequestMultipleFailsThenFailureIsReturned) {
setLocalMemorySupportedAndReinit(true);
pKmdSysManager->mockRequestMultiple = true;