drm/xe/guc: Formalize Reserved KLVs

We have already started using few KLV keys from the 0xF000 range
that, as we have agreed with the GuC team, will not be used in any
GuC ABI actions. Add definitions for that reserved range and move
our migration KLVs to new ABI header.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
Link: https://patch.msgid.link/20260710172534.7201-1-michal.wajdeczko@intel.com
This commit is contained in:
Michal Wajdeczko
2026-07-10 19:25:34 +02:00
parent 5598b9356c
commit 2963124ff9
4 changed files with 60 additions and 5 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -8,6 +8,7 @@
#include <drm/drm_print.h>
#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)";
}
}

View File

@@ -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)