File: kmd_sys.h

package info (click to toggle)
intel-compute-runtime 25.48.36300.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,652 kB
  • sloc: cpp: 939,022; lisp: 2,090; sh: 722; makefile: 162; python: 21
file content (612 lines) | stat: -rw-r--r-- 13,002 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
/*
 * Copyright (C) 2020-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#pragma once

#include <memory>
#include <stdint.h>

namespace L0 {

namespace KmdSysman {
constexpr uint32_t KmdMaxBufferSize = 2048;
constexpr uint32_t MaxPropertyBufferSize = 128;
constexpr uint32_t PcEscapeOperation = 35;
constexpr uint32_t KmdSysmanSuccess = 0;
constexpr uint32_t KmdSysmanFail = 1;
constexpr uint32_t KmdMajorVersion = 1;
constexpr uint32_t KmdMinorVersion = 0;
constexpr uint32_t KmdPatchNumber = 0;

struct GfxSysmanMainHeaderIn {
    uint32_t inVersion;
    uint32_t inNumElements;
    uint32_t inTotalsize;
    uint8_t inBuffer[KmdMaxBufferSize];
};

struct GfxSysmanMainHeaderOut {
    uint32_t outStatus;
    uint32_t outNumElements;
    uint32_t outTotalSize;
    uint8_t outBuffer[KmdMaxBufferSize];
};

struct GfxSysmanReqHeaderIn {
    uint32_t inRequestId;
    uint32_t inCommand;
    uint32_t inComponent;
    uint32_t inCommandParam;
    uint32_t inDataSize;
};

struct GfxSysmanReqHeaderOut {
    uint32_t outRequestId;
    uint32_t outComponent;
    uint32_t outReturnCode;
    uint32_t outDataSize;
};

enum Command {
    Get = 0,
    Set,
    RegisterEvent,
    UnregisterEvent,

    MaxCommands,
};

enum Events {
    EnergyThresholdCrossed = 0,
    EnterD0,
    EnterD3,
    EnterTDR,
    ExitTDR,
    FrequencyThrottled,
    CriticalTemperature,
    TemperatureThreshold1,
    TemperatureThreshold2,
    ResetDeviceRequired,

    MaxEvents,
};

enum Component {
    InterfaceProperties = 0,
    PowerComponent,
    FrequencyComponent,
    ActivityComponent,
    FanComponent,
    TemperatureComponent,
    FpsComponent,
    SchedulerComponent,
    MemoryComponent,
    PciComponent,
    GlobalOperationsComponent,
    StandbyComponent,
    PerformanceComponent,

    MaxComponents,
};

namespace Requests {

enum Interface {
    InterfaceVersion = 0,

    MaxInterfaceRequests,
};

enum Power {
    NumPowerDomains = 0,

    // support / enabled
    EnergyThresholdSupported,
    EnergyThresholdEnabled,
    PowerLimit1Enabled,
    PowerLimit2Enabled,

    // default fused values
    PowerLimit1Default,
    PowerLimit2Default,
    PowerLimit1TauDefault,
    PowerLimit4AcDefault,
    PowerLimit4DcDefault,
    EnergyThresholdDefault,
    TdpDefault,
    MinPowerLimitDefault,
    MaxPowerLimitDefault,
    EnergyCounterUnits,

    // current runtime values
    CurrentPowerLimit1,
    CurrentPowerLimit2,
    CurrentPowerLimit1Tau,
    CurrentPowerLimit4Ac,
    CurrentPowerLimit4Dc,
    CurrentEnergyThreshold,
    DisableEnergyThreshold,
    CurrentEnergyCounter,
    CurrentEnergyCounter64Bit,

    MaxPowerRequests,
};

enum Activity {
    NumActivityDomains = 0,

    // default fused values
    ActivityCounterNumberOfBits,
    ActivityCounterFrequency,
    TimestampFrequency,

    // current runtime values
    CurrentActivityCounter,

    NumberOfVfsEnabled,
    EngineInstancesPerGroup,
    // activity per engine
    CurrentCounterV2,
    // array of per-engine activities for all pf and vf
    CurrentCounterV2Ext,

    MaxActivityRequests,
};

enum Performance {
    NumPerformanceDomains = 0,
    SupportedDomains,
    Factor,
    MaxPerformanceRequests
};

enum Temperature {
    NumTemperatureDomains = 0,

    // support / enabled
    TempCriticalEventSupported,
    TempThreshold1EventSupported,
    TempThreshold2EventSupported,
    TempCriticalEventEnabled,
    TempThreshold1EventEnabled,
    TempThreshold2EventEnabled,

    // default fused values
    MaxTempSupported,

    // current runtime values
    CurrentTemperature,

    MaxTemperatureRequests,
};

enum Frequency {
    NumFrequencyDomains = 0,

    // support / enabled
    FrequencyOcSupported,
    VoltageOverrideSupported,
    VoltageOffsetSupported,
    HighVoltageModeSupported,
    ExtendedOcSupported,
    FixedModeSupported,
    HighVoltageEnabled,
    CanControlFrequency,
    FrequencyThrottledEventSupported,

    // default fused values
    TjMaxDefault,
    IccMaxDefault,
    MaxOcFrequencyDefault,
    MaxNonOcFrequencyDefault,
    MaxOcVoltageDefault,
    MaxNonOcVoltageDefault,
    FrequencyRangeMinDefault,
    FrequencyRangeMaxDefault,

    // current runtime values
    CurrentFrequencyTarget,
    CurrentVoltageTarget,
    CurrentVoltageOffset,
    CurrentVoltageMode,
    CurrentFixedMode,
    CurrentTjMax,
    CurrentIccMax,
    CurrentVoltage,
    CurrentRequestedFrequency,
    CurrentTdpFrequency,
    CurrentEfficientFrequency,
    CurrentResolvedFrequency,
    CurrentThrottleReasons,
    CurrentThrottleTime,
    CurrentFrequencyRange,
    SupportedFreqDomains = 38,

    MaxFrequencyRequests,
};

enum Fans {
    NumFanDomains = 0,

    // default fused values
    MaxFanControlPointsSupported,
    MaxFanSpeedSupported,

    // current runtime values
    CurrentNumOfControlPoints,
    CurrentFanPoint,
    CurrentFanSpeed,
    SupportedFanModeCapabilities,
    CurrentFanMode,
    CurrentFanIndex,

    MaxFanRequests,
};

enum Fps {
    NumFpsDomains = 0,
    IsDisplayAttached,
    InstRenderTime,
    TimeToFlip,
    AvgFps,
    AvgRenderTime,
    AvgInstFps,

    MaxFpsRequests,
};

enum Scheduler {
    NumSchedulerDomains = 0,

    MaxSchedulerRequests,
};

enum Memory {
    NumMemoryDomains = 0,

    // default fused values
    MemoryType,
    MemoryLocation,
    PhysicalSize,
    StolenSize,
    SystemSize,
    DedicatedSize,
    MemoryWidth,
    NumChannels,
    MaxBandwidth,

    // current runtime values
    CurrentBandwidthRead,
    CurrentBandwidthWrite,
    CurrentFreeMemorySize,
    CurrentTotalAllocableMem,

    MaxMemoryRequests
};

enum Pci {
    NumPciDomains = 0,

    // support / enabled
    BandwidthCountersSupported,
    PacketCountersSupported,
    ReplayCountersSupported,

    // default fused values
    DeviceId,
    VendorId,
    Domain,
    Bus,
    Device,
    Function,
    Gen,
    DevType,
    MaxLinkWidth,
    MaxLinkSpeed,
    BusInterface,
    BusWidth,
    BarType,
    BarIndex,
    BarBase,
    BarSize,

    // current runtime values
    CurrentLinkWidth,
    CurrentLinkSpeed,
    CurrentLinkStatus,
    CurrentLinkQualityFlags,
    CurrentLinkStabilityFlags,
    CurrentLinkReplayCounter,
    CurrentLinkPacketCounter,
    CurrentLinkRxCounter,
    CurrentLinkTxCounter,

    // resizable bar
    ResizableBarSupported,
    ResizableBarEnabled,

    MaxPciRequests,
};

enum GlobalOperation {
    NumGlobalOperationDomains = 0,

    TriggerDeviceLevelReset
};

} // namespace Requests

enum FlipType {
    MMIOFlip = 0,
    MMIOAsyncFlip,
    DMAFlip,
    DMAAsyncFlip,

    MaxFlipTypes,
};

enum GeneralDomainsType {
    GeneralDomainDGPU = 0,
    GeneralDomainHBM,
    GeneralDomainMedia,

    GeneralDomainMaxTypes,
};

enum TemperatureDomainsType {
    TemperatureDomainPackage = 0,
    TemperatureDomainDGPU,
    TemperatureDomainHBM,

    TempetatureMaxDomainTypes,
};

enum ActivityDomainsType {
    ActitvityDomainGT = 0,
    ActivityDomainRenderCompute,
    ActivityDomainMedia,

    ActivityDomainCopy,
    ActivityDomainComputeSingle,
    ActivityDomainRenderSingle,
    ActivityDomainMediaCodecSingle,
    ActivityDomainMediaEnhancementSingle,
    ActivityDomainCopySingle,

    ActivityDomainMaxTypes,
};

enum PciDomainsType {
    PciCurrentDevice = 0,
    PciParentDevice,
    PciRootPort,

    PciDomainMaxTypes,
};

enum MemoryType {
    DDR4 = 0,
    DDR5,
    LPDDR5,
    LPDDR4,
    DDR3,
    LPDDR3,
    GDDR4,
    GDDR5,
    GDDR5X,
    GDDR6,
    GDDR6X,
    GDDR7,
    UknownMemType,

    MaxMemoryTypes,
};

enum MemoryWidthType {
    MemWidth8x = 0,
    MemWidth16x,
    MemWidth32x,

    UnknownMemWidth,

    MaxMemoryWidthTypes,
};

enum MemoryLocationsType {
    SystemMemory = 0,
    DeviceMemory,

    UnknownMemoryLocation,

    MaxMemoryLocationTypes,
};

enum PciGensType {
    PciGen1_1 = 0,
    PciGen2_0,
    PciGen3_0,
    PciGen4_0,

    UnknownPciGen,

    MaxPciGenTypes,
};

enum PciLinkSpeedType {
    UnknownPciLinkSpeed = 0,
    PciLinkSpeed2_5 = 1,
    PciLinkSpeed5_0,
    PciLinkSpeed8_0,
    PciLinkSpeed16_0,

    MaxPciLinkSpeedTypes,
};

enum ReturnCodes {
    Success = 0,

    PcuError,
    IllegalCommand,
    TimeOut,
    IllegalData,
    IllegalSubCommand,
    OverclockingLocked,
    DomainServiceNotSupported,
    FrequencyExceedsMax,
    VoltageExceedsMax,
    OverclockingNotSupported,
    InvalidVr,
    InvalidIccMax,
    VoltageOverrideDisabled,
    ServiceNotAvailable,
    InvalidRequestType,
    InvalidComponent,
    BufferNotLargeEnough,
    GetNotSupported,
    SetNotSupported,
    MissingProperties,
    InvalidEvent,
    CreateEventError,
    ErrorVersion,
    ErrorSize,
    ErrorNoElements,
    ErrorBufferCorrupted,
    VTNotSupported,
    NotInitialized,
    PropertyNotSet,
    InvalidFlipType,
};

enum PciLinkWidthType {
    PciLinkWidth1x = 0,
    PciLinkWidth2x,
    PciLinkWidth4x,
    PciLinkWidth8x,
    PciLinkWidth12x,
    PciLinkWidth16x,
    PciLinkWidth32x,

    UnknownPciLinkWidth,

    MaxPciLinkWidthTypes,
};

enum FanUserMode {
    FanModeAll = 0, /// Means 1 user fan table is applied to all fan devices
    FanModeSingle,  /// Means configuration is on a per fan basis

    FanModeMax
};

struct KmdSysmanVersion {
    KmdSysmanVersion() : data(0) {}
    union {
        struct {
            uint32_t reservedBits : 8;
            uint32_t majorVersion : 8;
            uint32_t minorVersion : 8;
            uint32_t patchNumber : 8;
        };
        uint32_t data;
    };
};

struct RequestProperty {
    RequestProperty() : requestId(0), commandId(0), componentId(0), paramInfo(0), dataSize(0) {}
    RequestProperty(const RequestProperty &other) {
        requestId = other.requestId;
        commandId = other.commandId;
        componentId = other.componentId;
        paramInfo = other.paramInfo;
        dataSize = other.dataSize;
        if (other.dataSize > 0 && other.dataSize < MaxPropertyBufferSize) {
            memcpy_s(dataBuffer, other.dataSize, other.dataBuffer, other.dataSize);
        }
    }
    RequestProperty(uint32_t _requestId,
                    uint32_t _commandId,
                    uint32_t _componentId,
                    uint32_t _paramInfo,
                    uint32_t _dataSize,
                    uint8_t *_dataBuffer) {
        requestId = _requestId;
        commandId = _commandId;
        componentId = _componentId;
        paramInfo = _paramInfo;
        dataSize = _dataSize;
        if (dataSize > 0 && dataSize < MaxPropertyBufferSize && _dataBuffer) {
            memcpy_s(dataBuffer, dataSize, _dataBuffer, dataSize);
        }
    }
    RequestProperty &operator=(const RequestProperty &other) {
        if (this == &other) {
            return *this;
        }
        requestId = other.requestId;
        commandId = other.commandId;
        componentId = other.componentId;
        paramInfo = other.paramInfo;
        dataSize = other.dataSize;
        if (other.dataSize > 0 && other.dataSize < MaxPropertyBufferSize) {
            memcpy_s(dataBuffer, other.dataSize, other.dataBuffer, other.dataSize);
        }
        return *this;
    }
    uint32_t requestId;
    uint32_t commandId;
    uint32_t componentId;
    uint32_t paramInfo;
    uint32_t dataSize;
    uint8_t dataBuffer[MaxPropertyBufferSize] = {0};
};

struct ResponseProperty {
    ResponseProperty() : requestId(0), returnCode(0), componentId(0), dataSize(0) {}
    ResponseProperty(const ResponseProperty &other) {
        requestId = other.requestId;
        returnCode = other.returnCode;
        componentId = other.componentId;
        dataSize = other.dataSize;
        if (other.dataSize > 0 && other.dataSize < MaxPropertyBufferSize) {
            memcpy_s(dataBuffer, other.dataSize, other.dataBuffer, other.dataSize);
        }
    }
    ResponseProperty(uint32_t _requestId,
                     uint32_t _returnCode,
                     uint32_t _componentId,
                     uint32_t _dataSize,
                     uint8_t *_dataBuffer) {
        requestId = _requestId;
        returnCode = _returnCode;
        componentId = _componentId;
        dataSize = _dataSize;
        if (dataSize > 0 && dataSize < MaxPropertyBufferSize && _dataBuffer) {
            memcpy_s(dataBuffer, dataSize, _dataBuffer, dataSize);
        }
    }
    ResponseProperty &operator=(const ResponseProperty &other) {
        if (this == &other) {
            return *this;
        }
        this->requestId = other.requestId;
        this->returnCode = other.returnCode;
        this->componentId = other.componentId;
        this->dataSize = other.dataSize;
        if (other.dataSize > 0 && other.dataSize < MaxPropertyBufferSize) {
            memcpy_s(this->dataBuffer, other.dataSize, other.dataBuffer, other.dataSize);
        }
        return *this;
    }

    uint32_t requestId;
    uint32_t returnCode;
    uint32_t componentId;
    uint32_t dataSize;
    uint8_t dataBuffer[MaxPropertyBufferSize] = {0};
};
} // namespace KmdSysman
} // namespace L0