root/drivers/gpu/drm/xe/xe_ras_types.h
/* SPDX-License-Identifier: MIT */
/*
 * Copyright © 2026 Intel Corporation
 */

#ifndef _XE_RAS_TYPES_H_
#define _XE_RAS_TYPES_H_

#include <linux/types.h>

#define XE_RAS_NUM_COUNTERS                     16

/**
 * struct xe_ras_error_common - Error fields that are common across all products
 */
struct xe_ras_error_common {
        /** @severity: Error severity */
        u8 severity;
        /** @component: IP block where error originated */
        u8 component;
} __packed;

/**
 * struct xe_ras_error_unit - Error unit information
 */
struct xe_ras_error_unit {
        /** @tile: Tile identifier */
        u8 tile;
        /** @instance: Instance identifier specific to IP */
        u32 instance;
} __packed;

/**
 * struct xe_ras_error_cause - Error cause information
 */
struct xe_ras_error_cause {
        /** @cause: Cause/checker */
        u32 cause;
        /** @reserved: For future use */
        u8 reserved;
} __packed;

/**
 * struct xe_ras_error_product - Error fields that are specific to the product
 */
struct xe_ras_error_product {
        /** @unit: Unit within IP block */
        struct xe_ras_error_unit unit;
        /** @cause: Cause/checker */
        struct xe_ras_error_cause cause;
} __packed;

/**
 * struct xe_ras_error_class - Combines common and product-specific parts
 */
struct xe_ras_error_class {
        /** @common: Common error type and component */
        struct xe_ras_error_common common;
        /** @product: Product-specific unit and cause */
        struct xe_ras_error_product product;
} __packed;

/**
 * struct xe_ras_threshold_crossed - Data for threshold crossed event
 */
struct xe_ras_threshold_crossed {
        /** @ncounters: Number of error counters that crossed thresholds */
        u32 ncounters;
        /** @counters: Array of error counters that crossed threshold */
        struct xe_ras_error_class counters[XE_RAS_NUM_COUNTERS];
} __packed;

#endif