mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
fix: Skip adding device to list if context creation fails
Propogate error codes from ioctl failure properly up the layers so that we skip exposing bad root devices. Related-To: NEO-7709 Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
95bea7c92b
commit
d75c4d3ec7
@@ -18,6 +18,7 @@
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/utilities/tag_allocator.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
@@ -111,6 +112,28 @@ HWTEST_F(CommandStreamReceiverTest, WhenInitializeResourcesThenCallFillReusableA
|
||||
EXPECT_EQ(1u, pDevice->getUltCommandStreamReceiver<FamilyType>().fillReusableAllocationsListCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverTest, whenContextCreateReturnsFalseThenExpectCSRInitializeResourcesFail) {
|
||||
struct MyOsContext : OsContext {
|
||||
MyOsContext(uint32_t contextId,
|
||||
const EngineDescriptor &engineDescriptor) : OsContext(0, contextId, engineDescriptor) {}
|
||||
|
||||
bool initializeContext() override {
|
||||
initializeContextCalled++;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t initializeContextCalled = 0u;
|
||||
};
|
||||
|
||||
const EngineTypeUsage engineTypeUsageRegular{aub_stream::ENGINE_RCS, EngineUsage::Regular};
|
||||
MyOsContext osContext{0, EngineDescriptorHelper::getDefaultDescriptor(engineTypeUsageRegular)};
|
||||
auto &ultCsr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
ultCsr.resourcesInitialized = false;
|
||||
ultCsr.setupContext(osContext);
|
||||
bool ret = ultCsr.initializeResources();
|
||||
EXPECT_FALSE(ret);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverTest, givenCsrWhenCallFillReusableAllocationsListThenAllocateCommandBufferAndMakeItResident) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.SetAmountOfReusableAllocations.set(1);
|
||||
|
||||
Reference in New Issue
Block a user