summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorGustavo Sousa <gustavo.sousa@intel.com>2026-06-09 17:17:39 -0300
committerGustavo Sousa <gustavo.sousa@intel.com>2026-07-02 18:41:54 -0300
commit13bebc7171e6fd47ad7b28989c08283508fb4389 (patch)
tree95ea2763f92c5a7fc7743a72eaaa2885b59ba576 /drivers/gpu
parent4a2cd8a48eaec34c30db1941a07204406b66db5e (diff)
downloadlinux-next-13bebc7171e6fd47ad7b28989c08283508fb4389.tar.gz
linux-next-13bebc7171e6fd47ad7b28989c08283508fb4389.zip
drm/xe: Add graphics/media IPs and their step info to xe_probed_info
On GMDID-based platforms, the driver needs to probe the hardware by reading GMDID registers in order to identify the graphics/media/display IPs that are present in the platform as well as their stepping values. Currently, xe_info_init() has such a probing logic, but that task should be rather responsibility of xe_probe_info(). As such, move it to the latter. For pre-GMDID platforms, the IPs are identified via PCI devid and revid fields, which is arguably also hardware dependent. So do the same for those platforms. Reviewed-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com> Reviewed-by: Violet Monti <violet.monti@intel.com> Link: https://patch.msgid.link/20260609-xe-probe-info-v1-7-21e83e188e60@intel.com Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/xe/tests/xe_pci.c44
-rw-r--r--drivers/gpu/drm/xe/xe_pci.c88
2 files changed, 77 insertions, 55 deletions
diff --git a/drivers/gpu/drm/xe/tests/xe_pci.c b/drivers/gpu/drm/xe/tests/xe_pci.c
index a665d5dbc472..cd64b1d614c8 100644
--- a/drivers/gpu/drm/xe/tests/xe_pci.c
+++ b/drivers/gpu/drm/xe/tests/xe_pci.c
@@ -311,31 +311,35 @@ const void *xe_pci_id_gen_param(struct kunit *test, const void *prev, char *desc
}
EXPORT_SYMBOL_IF_KUNIT(xe_pci_id_gen_param);
-static int fake_read_gmdid(struct xe_device *xe, enum xe_gmdid_type type,
- u32 *ver, u32 *revid)
-{
- struct kunit *test = kunit_get_current_test();
- struct xe_pci_fake_data *data = test->priv;
-
- if (type == GMDID_MEDIA) {
- *ver = data->media_verx100;
- *revid = xe_step_to_gmdid(data->step.media);
- } else {
- *ver = data->graphics_verx100;
- *revid = xe_step_to_gmdid(data->step.graphics);
- }
-
- return 0;
-}
-
static void fake_xe_info_probe_tile_count(struct xe_device *xe)
{
/* Nothing to do, just use the statically defined value. */
}
static int fake_probe_info(struct xe_device *xe,
+ const struct xe_device_desc *desc,
+ struct xe_pci_fake_data *data,
struct xe_probed_info *probed_info)
{
+ if (!data || desc->pre_gmdid_graphics_ip) {
+ probed_info->graphics_ip = desc->pre_gmdid_graphics_ip;
+ probed_info->media_ip = desc->pre_gmdid_media_ip;
+ } else {
+ probed_info->graphics_ip = find_graphics_ip(data->graphics_verx100);
+
+ if (data->media_verx100) {
+ probed_info->media_ip = find_media_ip(data->media_verx100);
+ xe_assert(xe, probed_info->media_ip);
+ }
+ }
+
+ xe_assert(xe, probed_info->graphics_ip);
+ if (!probed_info->graphics_ip)
+ return -ENODEV;
+
+ if (data)
+ probed_info->step = data->step;
+
return 0;
}
@@ -377,20 +381,16 @@ done:
xe->sriov.__mode = data && data->sriov_mode ?
data->sriov_mode : XE_SRIOV_MODE_NONE;
- kunit_activate_static_stub(test, read_gmdid, fake_read_gmdid);
kunit_activate_static_stub(test, xe_info_probe_tile_count,
fake_xe_info_probe_tile_count);
- err = fake_probe_info(xe, &probed_info);
+ err = fake_probe_info(xe, desc, data, &probed_info);
if (err)
return err;
xe_info_init_early(xe, desc, subplatform_desc, &probed_info);
xe_info_init(xe, desc, &probed_info);
- if (data && !data->graphics_verx100)
- xe->info.step = data->step;
-
return 0;
}
EXPORT_SYMBOL_IF_KUNIT(xe_pci_fake_device_init);
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index fa43853eb591..ec1967e3e064 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -602,8 +602,6 @@ static int read_gmdid(struct xe_device *xe, enum xe_gmdid_type type, u32 *ver, u
struct xe_reg gmdid_reg = GMD_ID;
u32 val;
- KUNIT_STATIC_STUB_REDIRECT(read_gmdid, xe, type, ver, revid);
-
if (IS_SRIOV_VF(xe)) {
/*
* To get the value of the GMDID register, VFs must obtain it
@@ -733,6 +731,8 @@ struct xe_probed_info {
u16 devid;
u8 revid;
struct xe_step_info step;
+ const struct xe_ip *graphics_ip;
+ const struct xe_ip *media_ip;
};
/*
@@ -926,12 +926,59 @@ static struct xe_gt *alloc_media_gt(struct xe_tile *tile,
return gt;
}
+static int xe_probe_ips(struct xe_device *xe,
+ const struct xe_device_desc *desc,
+ struct xe_probed_info *probed_info)
+{
+ /*
+ * If this platform supports GMD_ID, we'll detect the proper IP
+ * descriptor to use from hardware registers.
+ * desc->pre_gmdid_graphics_ip will only ever be set at this point for
+ * platforms before GMD_ID. In that case the IP descriptions and
+ * versions are simply derived from that.
+ */
+ if (desc->pre_gmdid_graphics_ip) {
+ probed_info->graphics_ip = desc->pre_gmdid_graphics_ip;
+ probed_info->media_ip = desc->pre_gmdid_media_ip;
+ xe_step_pre_gmdid_get(xe, &probed_info->step);
+ } else {
+ int err;
+ u32 graphics_revid, media_revid;
+
+ xe_assert(xe, !desc->pre_gmdid_media_ip);
+
+ err = handle_gmdid(xe, &probed_info->graphics_ip, &probed_info->media_ip,
+ &graphics_revid, &media_revid);
+ if (err)
+ return err;
+
+ xe_step_gmdid_get(xe, graphics_revid, media_revid, &probed_info->step);
+ }
+
+ /*
+ * If we couldn't detect the graphics IP, that's considered a fatal
+ * error and we should abort driver load. Failing to detect media
+ * IP is non-fatal; we'll just proceed without enabling media support.
+ */
+ if (!probed_info->graphics_ip)
+ return -ENODEV;
+
+ return 0;
+}
+
/*
* Probe from the hardware the info required by xe_info_init().
*/
static int xe_probe_info(struct xe_device *xe,
+ const struct xe_device_desc *desc,
struct xe_probed_info *probed_info)
{
+ int err;
+
+ err = xe_probe_ips(xe, desc, probed_info);
+ if (err)
+ return err;
+
return 0;
}
@@ -945,44 +992,19 @@ static int xe_info_init(struct xe_device *xe,
const struct xe_device_desc *desc,
struct xe_probed_info *probed_info)
{
- u32 graphics_gmdid_revid = 0, media_gmdid_revid = 0;
const struct xe_ip *graphics_ip;
const struct xe_ip *media_ip;
const struct xe_graphics_desc *graphics_desc;
const struct xe_media_desc *media_desc;
struct xe_tile *tile;
struct xe_gt *gt;
- int ret;
u8 id;
- /*
- * If this platform supports GMD_ID, we'll detect the proper IP
- * descriptor to use from hardware registers.
- * desc->pre_gmdid_graphics_ip will only ever be set at this point for
- * platforms before GMD_ID. In that case the IP descriptions and
- * versions are simply derived from that.
- */
- if (desc->pre_gmdid_graphics_ip) {
- graphics_ip = desc->pre_gmdid_graphics_ip;
- media_ip = desc->pre_gmdid_media_ip;
- xe_step_pre_gmdid_get(xe, &xe->info.step);
- } else {
- xe_assert(xe, !desc->pre_gmdid_media_ip);
- ret = handle_gmdid(xe, &graphics_ip, &media_ip,
- &graphics_gmdid_revid, &media_gmdid_revid);
- if (ret)
- return ret;
-
- xe_step_gmdid_get(xe, graphics_gmdid_revid, media_gmdid_revid, &xe->info.step);
- }
-
- /*
- * If we couldn't detect the graphics IP, that's considered a fatal
- * error and we should abort driver load. Failing to detect media
- * IP is non-fatal; we'll just proceed without enabling media support.
- */
- if (!graphics_ip)
- return -ENODEV;
+ graphics_ip = probed_info->graphics_ip;
+ media_ip = probed_info->media_ip;
+ xe->info.step.basedie = probed_info->step.basedie;
+ xe->info.step.graphics = probed_info->step.graphics;
+ xe->info.step.media = probed_info->step.media;
xe->info.graphics_verx100 = graphics_ip->verx100;
xe->info.graphics_name = graphics_ip->name;
@@ -1175,7 +1197,7 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (err)
return err;
- err = xe_probe_info(xe, &probed_info);
+ err = xe_probe_info(xe, desc, &probed_info);
if (err)
return err;