Skip to content

Commit 1cca556

Browse files
feature: Retrieve CXL type info from drm query
Related-To: NEO-11362 Signed-off-by: Aravind Gopalakrishnan <[email protected]>
1 parent d2d8925 commit 1cca556

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ bool IoctlHelperXe::initialize() {
153153
hwInfo->platform.usRevId = static_cast<int>((config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16) & 0xff);
154154
hwInfo->capabilityTable.gpuAddressSpace = (1ull << config->info[DRM_XE_QUERY_CONFIG_VA_BITS]) - 1;
155155

156+
hwInfo->capabilityTable.cxlType = getCxlType(config);
157+
156158
queryGtListData = queryData<uint64_t>(DRM_XE_DEVICE_QUERY_GT_LIST);
157159

158160
if (queryGtListData.empty()) {

shared/source/os_interface/linux/xe/ioctl_helper_xe.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
struct drm_xe_engine_class_instance;
1919
struct drm_xe_query_gt_list;
20+
struct drm_xe_query_config;
2021

2122
namespace NEO {
2223

@@ -154,6 +155,7 @@ class IoctlHelperXe : public IoctlHelper {
154155
void *freeDebugMetadata(void *metadata);
155156
int getRunaloneExtProperty();
156157
virtual bool isExtraEngineClassAllowed(uint16_t engineClass) const { return false; }
158+
virtual uint32_t getCxlType(struct drm_xe_query_config *config) { return 0u; }
157159

158160
struct UserFenceExtension {
159161
static constexpr uint32_t tagValue = 0x123987;

shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,7 @@ TEST(IoctlHelperXeTest, whenInitializeThenProperHwInfoIsSet) {
18881888
EXPECT_EQ(drm.revId, hwInfo->platform.usRevId);
18891889
EXPECT_EQ(drm.devId, hwInfo->platform.usDeviceID);
18901890
EXPECT_EQ((1ull << 48) - 1, hwInfo->capabilityTable.gpuAddressSpace);
1891+
EXPECT_EQ(static_cast<uint32_t>(DrmMockXe::mockDefaultCxlType), hwInfo->capabilityTable.cxlType);
18911892

18921893
EXPECT_EQ(DrmMockXe::mockMaxExecQueuePriority, ioctlHelper->maxExecQueuePriority);
18931894
}

shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class DrmMockXe : public DrmMockCustom {
8282
DrmMockXe(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockCustom(rootDeviceEnvironment) {
8383

8484
auto xeQueryConfig = reinterpret_cast<drm_xe_query_config *>(queryConfig);
85-
xeQueryConfig->num_params = 5;
85+
xeQueryConfig->num_params = 6;
8686
xeQueryConfig->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] = (revId << 16) | devId;
8787
xeQueryConfig->info[DRM_XE_QUERY_CONFIG_VA_BITS] = 48;
8888
xeQueryConfig->info[DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY] = mockMaxExecQueuePriority;
@@ -363,9 +363,10 @@ class DrmMockXe : public DrmMockCustom {
363363
const uint16_t revId = 0x12;
364364
const uint16_t devId = 0xabc;
365365

366-
uint64_t queryConfig[6]{}; // 1 qword for num params and 1 qwords per param
366+
uint64_t queryConfig[7]{}; // 1 qword for num params and 1 qwords per param
367367
static constexpr uint32_t mockExecQueueId = 1234;
368368
static constexpr int32_t mockMaxExecQueuePriority = 3;
369+
static constexpr int32_t mockDefaultCxlType = 0;
369370
static constexpr uint32_t mockTimestampFrequency = 12500000;
370371
static_assert(sizeof(drm_xe_engine) == 4 * sizeof(uint64_t), "");
371372
uint64_t queryEngines[52]{}; // 1 qword for num engines and 4 qwords per engine

0 commit comments

Comments
 (0)