mirror of
https://github.com/fumiama/gozel.git
synced 2026-06-06 00:40:23 +08:00
296 lines
15 KiB
Go
296 lines
15 KiB
Go
// Code generated by cmd/gen. DO NOT EDIT.
|
|
|
|
/*
|
|
*
|
|
* Copyright (C) 2019-2025 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* @file zes_api.h
|
|
* @version v1.15-r1.15.31
|
|
*
|
|
*/
|
|
|
|
package gozel
|
|
|
|
import (
|
|
"unsafe"
|
|
|
|
"github.com/fumiama/gozel/internal/zecall"
|
|
)
|
|
|
|
// ZesRasErrorType (zes_ras_error_type_t) RAS error type
|
|
type ZesRasErrorType uintptr
|
|
|
|
const (
|
|
ZES_RAS_ERROR_TYPE_CORRECTABLE ZesRasErrorType = 0 // ZES_RAS_ERROR_TYPE_CORRECTABLE Errors were corrected by hardware
|
|
ZES_RAS_ERROR_TYPE_UNCORRECTABLE ZesRasErrorType = 1 // ZES_RAS_ERROR_TYPE_UNCORRECTABLE Error were not corrected
|
|
ZES_RAS_ERROR_TYPE_FORCE_UINT32 ZesRasErrorType = 0x7fffffff // ZES_RAS_ERROR_TYPE_FORCE_UINT32 Value marking end of ZES_RAS_ERROR_TYPE_* ENUMs
|
|
|
|
)
|
|
|
|
// ZesRasErrorCat (zes_ras_error_cat_t) RAS error categories
|
|
type ZesRasErrorCat uintptr
|
|
|
|
const (
|
|
ZES_RAS_ERROR_CAT_RESET ZesRasErrorCat = 0 // ZES_RAS_ERROR_CAT_RESET The number of accelerator engine resets attempted by the driver
|
|
ZES_RAS_ERROR_CAT_PROGRAMMING_ERRORS ZesRasErrorCat = 1 // ZES_RAS_ERROR_CAT_PROGRAMMING_ERRORS The number of hardware exceptions generated by the way workloads have
|
|
|
|
///< programmed the hardware
|
|
|
|
ZES_RAS_ERROR_CAT_DRIVER_ERRORS ZesRasErrorCat = 2 // ZES_RAS_ERROR_CAT_DRIVER_ERRORS The number of low level driver communication errors have occurred
|
|
ZES_RAS_ERROR_CAT_COMPUTE_ERRORS ZesRasErrorCat = 3 // ZES_RAS_ERROR_CAT_COMPUTE_ERRORS The number of errors that have occurred in the compute accelerator
|
|
|
|
///< hardware
|
|
|
|
ZES_RAS_ERROR_CAT_NON_COMPUTE_ERRORS ZesRasErrorCat = 4 // ZES_RAS_ERROR_CAT_NON_COMPUTE_ERRORS The number of errors that have occurred in the fixed-function
|
|
|
|
///< accelerator hardware
|
|
|
|
ZES_RAS_ERROR_CAT_CACHE_ERRORS ZesRasErrorCat = 5 // ZES_RAS_ERROR_CAT_CACHE_ERRORS The number of errors that have occurred in caches (L1/L3/register
|
|
|
|
///< file/shared local memory/sampler)
|
|
|
|
ZES_RAS_ERROR_CAT_DISPLAY_ERRORS ZesRasErrorCat = 6 // ZES_RAS_ERROR_CAT_DISPLAY_ERRORS The number of errors that have occurred in the display
|
|
ZES_RAS_ERROR_CAT_FORCE_UINT32 ZesRasErrorCat = 0x7fffffff // ZES_RAS_ERROR_CAT_FORCE_UINT32 Value marking end of ZES_RAS_ERROR_CAT_* ENUMs
|
|
|
|
)
|
|
|
|
// ZES_MAX_RAS_ERROR_CATEGORY_COUNT The maximum number of categories
|
|
const ZES_MAX_RAS_ERROR_CATEGORY_COUNT = 7
|
|
|
|
// ZesRasProperties (zes_ras_properties_t) RAS properties
|
|
type ZesRasProperties struct {
|
|
Stype ZesStructureType // Stype [in] type of this structure
|
|
Pnext unsafe.Pointer // Pnext [in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
|
|
Type ZesRasErrorType // Type [out] The type of RAS error
|
|
Onsubdevice ZeBool // Onsubdevice [out] True if the resource is located on a sub-device; false means that the resource is on the device of the calling Sysman handle
|
|
Subdeviceid uint32 // Subdeviceid [out] If onSubdevice is true, this gives the ID of the sub-device
|
|
|
|
}
|
|
|
|
// ZesRasState (zes_ras_state_t) RAS error details
|
|
type ZesRasState struct {
|
|
Stype ZesStructureType // Stype [in] type of this structure
|
|
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
|
|
Category [ZES_MAX_RAS_ERROR_CATEGORY_COUNT]uint64 // Category [in][out] Breakdown of error by category
|
|
|
|
}
|
|
|
|
// ZesRasConfig (zes_ras_config_t) RAS error configuration - thresholds used for triggering RAS events
|
|
// / (::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS,
|
|
// / ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS)
|
|
// /
|
|
// / @details
|
|
// / - The driver maintains a total counter which is updated every time a
|
|
// / hardware block covered by the corresponding RAS error set notifies
|
|
// / that an error has occurred. When this total count goes above the
|
|
// / totalThreshold specified below, a RAS event is triggered.
|
|
// / - The driver also maintains a counter for each category of RAS error
|
|
// / (see ::zes_ras_state_t for a breakdown). Each time a hardware block of
|
|
// / that category notifies that an error has occurred, that corresponding
|
|
// / category counter is updated. When it goes above the threshold
|
|
// / specified in detailedThresholds, a RAS event is triggered.
|
|
type ZesRasConfig struct {
|
|
Stype ZesStructureType // Stype [in] type of this structure
|
|
Pnext unsafe.Pointer // Pnext [in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
|
|
Totalthreshold uint64 // Totalthreshold [in,out] If the total RAS errors exceeds this threshold, the event will be triggered. A value of 0ULL disables triggering the event based on the total counter.
|
|
Detailedthresholds ZesRasState // Detailedthresholds [in,out] If the RAS errors for each category exceed the threshold for that category, the event will be triggered. A value of 0ULL will disable an event being triggered for that category.
|
|
|
|
}
|
|
|
|
// ZesDeviceEnumRasErrorSets Get handle of all RAS error sets on a device
|
|
// /
|
|
// / @details
|
|
// / - A RAS error set is a collection of RAS error counters of a given type
|
|
// / (correctable/uncorrectable) from hardware blocks contained within a
|
|
// / sub-device or within the device.
|
|
// / - A device without sub-devices will typically return two handles, one
|
|
// / for correctable errors sets and one for uncorrectable error sets.
|
|
// / - A device with sub-devices will return RAS error sets for each
|
|
// / sub-device and possibly RAS error sets for hardware blocks outside the
|
|
// / sub-devices.
|
|
// / - If the function completes successfully but pCount is set to 0, RAS
|
|
// / features are not available/enabled on this device.
|
|
// / - The application may call this function from simultaneous threads.
|
|
// / - The implementation of this function should be lock-free.
|
|
// /
|
|
// / @returns
|
|
// / - ::ZE_RESULT_SUCCESS
|
|
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
|
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
|
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
|
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
|
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
|
// / - ::ZE_RESULT_ERROR_UNKNOWN
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
|
// / + `nullptr == hDevice`
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
// / + `nullptr == pCount`
|
|
func ZesDeviceEnumRasErrorSets(
|
|
hDevice ZesDeviceHandle, // hDevice [in] Sysman handle of the device.
|
|
pCount *uint32, // pCount [in,out] pointer to the number of components of this type. if count is zero, then the driver shall update the value with the total number of components of this type that are available. if count is greater than the number of components of this type that are available, then the driver shall update the value with the correct number of components.
|
|
phRas *ZesRasHandle, // phRas [in,out][optional][range(0, *pCount)] array of handle of components of this type. if count is less than the number of components of this type that are available, then the driver shall only retrieve that number of component handles.
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zesDeviceEnumRasErrorSets", uintptr(hDevice), uintptr(unsafe.Pointer(pCount)), uintptr(unsafe.Pointer(phRas)))
|
|
}
|
|
|
|
// ZesRasGetProperties Get RAS properties of a given RAS error set - this enables discovery
|
|
// / of the type of RAS error set (correctable/uncorrectable) and if
|
|
// / located on a sub-device
|
|
// /
|
|
// / @details
|
|
// / - The application may call this function from simultaneous threads.
|
|
// / - The implementation of this function should be lock-free.
|
|
// /
|
|
// / @returns
|
|
// / - ::ZE_RESULT_SUCCESS
|
|
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
|
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
|
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
|
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
|
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
|
// / - ::ZE_RESULT_ERROR_UNKNOWN
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
|
// / + `nullptr == hRas`
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
// / + `nullptr == pProperties`
|
|
func ZesRasGetProperties(
|
|
hRas ZesRasHandle, // hRas [in] Handle for the component.
|
|
pProperties *ZesRasProperties, // pProperties [in,out] Structure describing RAS properties
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zesRasGetProperties", uintptr(hRas), uintptr(unsafe.Pointer(pProperties)))
|
|
}
|
|
|
|
// ZesRasGetConfig Get RAS error thresholds that control when RAS events are generated
|
|
// /
|
|
// / @details
|
|
// / - The driver maintains counters for all RAS error sets and error
|
|
// / categories. Events are generated when errors occur. The configuration
|
|
// / enables setting thresholds to limit when events are sent.
|
|
// / - When a particular RAS correctable error counter exceeds the configured
|
|
// / threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will
|
|
// / be triggered.
|
|
// / - When a particular RAS uncorrectable error counter exceeds the
|
|
// / configured threshold, the event
|
|
// / ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be triggered.
|
|
// / - The application may call this function from simultaneous threads.
|
|
// / - The implementation of this function should be lock-free.
|
|
// /
|
|
// / @returns
|
|
// / - ::ZE_RESULT_SUCCESS
|
|
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
|
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
|
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
|
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
|
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
|
// / - ::ZE_RESULT_ERROR_UNKNOWN
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
|
// / + `nullptr == hRas`
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
// / + `nullptr == pConfig`
|
|
func ZesRasGetConfig(
|
|
hRas ZesRasHandle, // hRas [in] Handle for the component.
|
|
pConfig *ZesRasConfig, // pConfig [in,out] Will be populed with the current RAS configuration - thresholds used to trigger events
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zesRasGetConfig", uintptr(hRas), uintptr(unsafe.Pointer(pConfig)))
|
|
}
|
|
|
|
// ZesRasSetConfig Set RAS error thresholds that control when RAS events are generated
|
|
// /
|
|
// / @details
|
|
// / - The driver maintains counters for all RAS error sets and error
|
|
// / categories. Events are generated when errors occur. The configuration
|
|
// / enables setting thresholds to limit when events are sent.
|
|
// / - When a particular RAS correctable error counter exceeds the specified
|
|
// / threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will
|
|
// / be generated.
|
|
// / - When a particular RAS uncorrectable error counter exceeds the
|
|
// / specified threshold, the event
|
|
// / ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be generated.
|
|
// / - Call ::zesRasGetState() and set the clear flag to true to restart
|
|
// / event generation once counters have exceeded thresholds.
|
|
// / - The application may call this function from simultaneous threads.
|
|
// / - The implementation of this function should be lock-free.
|
|
// /
|
|
// / @returns
|
|
// / - ::ZE_RESULT_SUCCESS
|
|
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
|
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
|
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
|
// / - ::ZE_RESULT_ERROR_UNKNOWN
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
|
// / + `nullptr == hRas`
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
// / + `nullptr == pConfig`
|
|
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
|
// / + Another running process is controlling these settings.
|
|
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
|
// / + Don't have permissions to set thresholds.
|
|
func ZesRasSetConfig(
|
|
hRas ZesRasHandle, // hRas [in] Handle for the component.
|
|
pConfig *ZesRasConfig, // pConfig [in] Change the RAS configuration - thresholds used to trigger events
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zesRasSetConfig", uintptr(hRas), uintptr(unsafe.Pointer(pConfig)))
|
|
}
|
|
|
|
// ZesRasGetState Get the current value of RAS error counters for a particular error set
|
|
// /
|
|
// / @details
|
|
// / - Clearing errors will affect other threads/applications - the counter
|
|
// / values will start from zero.
|
|
// / - Clearing errors requires write permissions.
|
|
// / - The application may call this function from simultaneous threads.
|
|
// / - The implementation of this function should be lock-free.
|
|
// /
|
|
// / @returns
|
|
// / - ::ZE_RESULT_SUCCESS
|
|
// / - ::ZE_RESULT_ERROR_UNINITIALIZED
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_LOST
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
|
|
// / - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
|
|
// / - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
|
|
// / - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE
|
|
// / - ::ZE_RESULT_ERROR_NOT_AVAILABLE
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET
|
|
// / - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE
|
|
// / - ::ZE_RESULT_ERROR_UNKNOWN
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
|
|
// / + `nullptr == hRas`
|
|
// / - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
|
|
// / + `nullptr == pState`
|
|
// / - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
|
|
// / + Don't have permissions to clear error counters.
|
|
func ZesRasGetState(
|
|
hRas ZesRasHandle, // hRas [in] Handle for the component.
|
|
clear ZeBool, // clear [in] Set to 1 to clear the counters of this type
|
|
pState *ZesRasState, // pState [in,out] Breakdown of where errors have occurred
|
|
) (ZeResult, error) {
|
|
return zecall.Call[ZeResult]("zesRasGetState", uintptr(hRas), uintptr(clear), uintptr(unsafe.Pointer(pState)))
|
|
}
|