diff --git a/drivers/gpu/drm/xe/abi/guc_klvs_abi.h b/drivers/gpu/drm/xe/abi/guc_klvs_abi.h index b83201a1b6da..685c4ef17b73 100644 --- a/drivers/gpu/drm/xe/abi/guc_klvs_abi.h +++ b/drivers/gpu/drm/xe/abi/guc_klvs_abi.h @@ -22,6 +22,7 @@ * | | | - `GuC Scheduling Policies KLVs`_ | * | | | - `GuC VGT Policy KLVs`_ | * | | | - `GuC VF Configuration KLVs`_ | + * | | | - `GuC Reserved KLVs`_ | * | | | | * | +-------+--------------------------------------------------------------+ * | | 15:0 | **LEN** - length of VALUE (in 32bit dwords) | @@ -526,4 +527,20 @@ enum xe_guc_klv_ids { GUC_WA_KLV_IGNORE_MMIO_READ_SEM_TOKEN_64 = 0x9010, }; +/** + * DOC: GuC Reserved KLVs + * + * Range of `GuC KLV`_ keys reserved for internal use by the GuC that will + * never be part of the offcial GuC ABI and can be reused by the drivers. + * + * Currently this range includes 1024 keys starting from: + * + * _`GUC_KLV_RESERVED_RANGE_START` : 0xF000 + * + * See `Xe Driver KLVs`_ for the KLVs that the Xe driver is currently using. + */ + +#define GUC_KLV_RESERVED_RANGE_START 0xf000u +#define GUC_KLV_RESERVED_RANGE_LEN 1024u + #endif diff --git a/drivers/gpu/drm/xe/abi/xe_driver_klvs_abi.h b/drivers/gpu/drm/xe/abi/xe_driver_klvs_abi.h new file mode 100644 index 000000000000..3b557e56892a --- /dev/null +++ b/drivers/gpu/drm/xe/abi/xe_driver_klvs_abi.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Copyright © 2026 Intel Corporation + */ + +#ifndef _ABI_XE_DRIVER_KLVS_ABI_H +#define _ABI_XE_DRIVER_KLVS_ABI_H + +#include "abi/guc_klvs_abi.h" + +/** + * DOC: Xe Driver KLVs + * + * The Xe driver uses the following keys from the `GuC Reserved KLVs`_ range: + * + * _`MIGRATION_KLV_DEVICE_DEVID_KEY` : + * PCI device ID of the migrated VF. + * _`MIGRATION_KLV_DEVICE_REVID_KEY` : + * PCI device revision ID of the migrated VF. + */ + +#define MIGRATION_KLV_DEVICE_DEVID_KEY 0xf001u +#define MIGRATION_KLV_DEVICE_DEVID_LEN 1u +#define MIGRATION_KLV_DEVICE_REVID_KEY 0xf002u +#define MIGRATION_KLV_DEVICE_REVID_LEN 1u + +#endif diff --git a/drivers/gpu/drm/xe/xe_guc_klv_helpers.c b/drivers/gpu/drm/xe/xe_guc_klv_helpers.c index 7ad0b6f88f4c..cf6cd862e2d2 100644 --- a/drivers/gpu/drm/xe/xe_guc_klv_helpers.c +++ b/drivers/gpu/drm/xe/xe_guc_klv_helpers.c @@ -8,6 +8,7 @@ #include #include "abi/guc_klvs_abi.h" +#include "abi/xe_driver_klvs_abi.h" #include "xe_guc_klv_helpers.h" #include "xe_guc_klv_thresholds_set.h" @@ -19,6 +20,11 @@ static bool is_group_key(u16 key) return false; } +static bool is_reserved_key(u16 key) +{ + return in_range(key, GUC_KLV_RESERVED_RANGE_START, GUC_KLV_RESERVED_RANGE_LEN); +} + /** * xe_guc_klv_key_to_string - Convert KLV key into friendly name. * @key: the `GuC KLV`_ key @@ -80,7 +86,15 @@ const char *xe_guc_klv_key_to_string(u16 key) MAKE_XE_GUC_KLV_THRESHOLDS_SET(define_threshold_key_to_string_case) #undef define_threshold_key_to_string_case + /* driver KLVs */ + case MIGRATION_KLV_DEVICE_DEVID_KEY: + return "migration_devid"; + case MIGRATION_KLV_DEVICE_REVID_KEY: + return "migration_revid"; + default: + if (is_reserved_key(key)) + return "(reserved)"; return "(unknown)"; } } diff --git a/drivers/gpu/drm/xe/xe_sriov_packet.c b/drivers/gpu/drm/xe/xe_sriov_packet.c index 2ae9eff2a7c0..e581e8e6c1d1 100644 --- a/drivers/gpu/drm/xe/xe_sriov_packet.c +++ b/drivers/gpu/drm/xe/xe_sriov_packet.c @@ -3,6 +3,8 @@ * Copyright © 2025 Intel Corporation */ +#include "abi/xe_driver_klvs_abi.h" + #include "xe_bo.h" #include "xe_device.h" #include "xe_guc_klv_helpers.h" @@ -352,11 +354,6 @@ ssize_t xe_sriov_packet_write_single(struct xe_device *xe, unsigned int vfid, return copied; } -#define MIGRATION_KLV_DEVICE_DEVID_KEY 0xf001u -#define MIGRATION_KLV_DEVICE_DEVID_LEN 1u -#define MIGRATION_KLV_DEVICE_REVID_KEY 0xf002u -#define MIGRATION_KLV_DEVICE_REVID_LEN 1u - #define MIGRATION_DESCRIPTOR_DWORDS (GUC_KLV_LEN_MIN + MIGRATION_KLV_DEVICE_DEVID_LEN + \ GUC_KLV_LEN_MIN + MIGRATION_KLV_DEVICE_REVID_LEN) static int pf_descriptor_init(struct xe_device *xe, unsigned int vfid)