Add support for querying hw info that UMDs need
Subsystems (3)
cover Add support for querying hw info that UMDs need
From: John Harrison <[email protected]>
Various UMDs require hardware configuration information about the current platform. A bunch of static information is available in a fixed table that can be retrieved from the GuC.
Test-with: [email protected]
UMD: https://github.com/intel/compute-runtime/pull/432/files
UMD: https://github.com/intel/media-driver/pull/1239/files
John Harrison (1):
drm/i915/guc: Add fetch of hwconfig table
Rodrigo Vivi (1):
drm/i915/uapi: Add query for hwconfig table
drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 1 + .../gpu/drm/i915/gt/uc/abi/guc_errors_abi.h | 4 + drivers/gpu/drm/i915/gt/uc/intel_guc.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 2 + .../gpu/drm/i915/gt/uc/intel_guc_hwconfig.c | 156 ++++++++++++++++++ .../gpu/drm/i915/gt/uc/intel_guc_hwconfig.h | 19 +++ drivers/gpu/drm/i915/gt/uc/intel_uc.c | 6 + drivers/gpu/drm/i915/i915_query.c | 23 +++ include/uapi/drm/i915_drm.h | 1 + 10 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.c create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.h
Signature · 1 line
2.25.1
PATCH 1/2 drm/i915/guc: Add fetch of hwconfig table
From: John Harrison <[email protected]>
Implement support for fetching the hardware description table from the GuC. The call is made twice - once without a destination buffer to query the size and then a second time to fill in the buffer.
Note that the table is only available on ADL-P and later platforms.
--- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 1 + .../gpu/drm/i915/gt/uc/abi/guc_errors_abi.h | 4 + drivers/gpu/drm/i915/gt/uc/intel_guc.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 2 + .../gpu/drm/i915/gt/uc/intel_guc_hwconfig.c | 156 ++++++++++++++++++ .../gpu/drm/i915/gt/uc/intel_guc_hwconfig.h | 19 +++ drivers/gpu/drm/i915/gt/uc/intel_uc.c | 6 + 8 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.c create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -190,6 +190,7 @@ i915-y += gt/uc/intel_uc.o \ gt/uc/intel_guc_rc.o \ gt/uc/intel_guc_slpc.o \ gt/uc/intel_guc_submission.o \ + gt/uc/intel_guc_hwconfig.o \ gt/uc/intel_huc.o \ gt/uc/intel_huc_debugfs.o \ gt/uc/intel_huc_fw.o
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +1 -0
@@ -137,6 +137,7 @@ enum intel_guc_action {INTEL_GUC_ACTION_ENGINE_FAILURE_NOTIFICATION =0x1009 ,INTEL_GUC_ACTION_SETUP_PC_GUCRC =0x3004 ,INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 , +INTEL_GUC_ACTION_GET_HWCONFIG =0x4100 ,INTEL_GUC_ACTION_REGISTER_CONTEXT =0x4502 ,INTEL_GUC_ACTION_DEREGISTER_CONTEXT =0x4503 , INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER = 0x4505,
drivers/gpu/drm/i915/gt/uc/abi/guc_errors_abi.h +4 -0
@@ -8,6 +8,10 @@enum intel_guc_response_status {INTEL_GUC_RESPONSE_STATUS_SUCCESS =0x0 , +INTEL_GUC_RESPONSE_NOT_SUPPORTED =0x20 , +INTEL_GUC_RESPONSE_NO_ATTRIBUTE_TABLE =0x201 , +INTEL_GUC_RESPONSE_NO_DECRYPTION_KEY =0x202 , +INTEL_GUC_RESPONSE_DECRYPTION_FAILED =0x204 ,INTEL_GUC_RESPONSE_STATUS_GENERIC_FAIL =0xF000 , };
drivers/gpu/drm/i915/gt/uc/intel_guc.c +2 -1
@@ -422,13 +422,14 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,/* * No GuC command should ever take longer than 10ms. * Fast commands should still complete in 10us. +* Except for the hwconfig table query, which takes ~50ms. */ ret =__intel_wait_for_register_fw (uncore,guc_send_reg (guc,0 ),GUC_HXG_MSG_0_ORIGIN ,FIELD_PREP (GUC_HXG_MSG_0_ORIGIN ,GUC_HXG_ORIGIN_GUC ), -10 ,10 , &header); +10 ,100 , &header);if (unlikely (ret)) { timeout: drm_err(&i915->drm, "mmio request %#x: no reply %x\n",
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
@@ -13,6 +13,7 @@#include "intel_guc_fw.h" #include "intel_guc_fwif.h" #include "intel_guc_ct.h" +#include "intel_guc_hwconfig.h" #include "intel_guc_log.h" #include "intel_guc_reg.h" #include "intel_guc_slpc_types.h"
@@ -37,6 +38,7 @@ struct intel_guc {struct intel_guc_ct ct;/** @slpc: sub-structure containing SLPC related data and objects */ struct intel_guc_slpc slpc; +struct intel_guc_hwconfig hwconfig;/** @sched_engine: Global engine used to submit requests to GuC */ struct i915_sched_engine *sched_engine;
drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.c new file +156 -0
156 lines not on this page · raw message
drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2021 Intel Corporation +*/ + +#ifndef _INTEL_GUC_HWCONFIG_H_ +#define _INTEL_GUC_HWCONFIG_H_ + +#include <linux/types.h> + +struct intel_guc_hwconfig { +u32 size; +void *ptr; +}; + +int intel_guc_hwconfig_init (struct intel_guc_hwconfig *hwconfig); +void intel_guc_hwconfig_fini (struct intel_guc_hwconfig *hwconfig); + +#endif /* _INTEL_GUC_HWCONFIG_H_ */
drivers/gpu/drm/i915/gt/uc/intel_uc.c +6 -0
@@ -486,6 +486,10 @@ static int __uc_init_hw(struct intel_uc *uc)if (ret) goto err_log_capture; + ret =intel_guc_hwconfig_init (&guc->hwconfig); +if (ret) +drm_err (&i915->drm,"Failed to retrieve hwconfig table: %d\n" , ret); + ret =guc_enable_communication (guc);if (ret) goto err_log_capture;
@@ -553,6 +557,8 @@ static void __uc_fini_hw(struct intel_uc *uc)if (intel_uc_uses_guc_submission (uc))intel_guc_submission_disable (guc); +intel_guc_hwconfig_fini (&guc->hwconfig); +__uc_sanitize (uc); }
Signature · 1 line
2.25.1
PATCH 2/2 drm/i915/uapi: Add query for hwconfig table
In reply to [email protected]From: Rodrigo Vivi <[email protected]>
GuC contains a consolidated table with a bunch of information about the current device.
Previously, this information was spread and hardcoded to all the components including GuC, i915 and various UMDs. The goal here is to consolidate the data into GuC in a way that all interested components can grab the very latest and synchronized information using a simple query.
As per most of the other queries, this one can be called twice. Once with item.length=0 to determine the exact buffer size, then allocate the user memory and call it again for to retrieve the table data. For example:
struct drm_i915_query_item item = {
.query_id = DRM_I915_QUERY_HWCONCFIG_TABLE; };
query.items_ptr = (int64_t) &item;
query.num_items = 1;
ioctl(fd, DRM_IOCTL_I915_QUERY, query, sizeof(query));
if (item.length <= 0)
return -ENOENT;
data = malloc(item.length); item.data_ptr = (int64_t) &data; ioctl(fd, DRM_IOCTL_I915_QUERY, query, sizeof(query));
// Parse the data as appropriate...
The returned array is a simple and flexible KLV (Key/Length/Value) formatted table. For example, it could be just:
enum device_attr {
ATTR_SOME_VALUE = 0,
ATTR_SOME_MASK = 1,
};
static const u32 hwconfig[] = {
ATTR_SOME_VALUE,
1, // Value Length in DWords
8, // Value ATTR_SOME_MASK,
3,
0x00FFFFFFFF, 0xFFFFFFFF, 0xFF000000,};
The attribute ids are defined in a hardware spec.
--- drivers/gpu/drm/i915/i915_query.c | 23 +++++++++++++++++++++++ include/uapi/drm/i915_drm.h | 1 + 2 files changed, 24 insertions(+)
drivers/gpu/drm/i915/i915_query.c +23 -0
@@ -477,12 +477,35 @@ static int query_memregion_info(struct drm_i915_private *i915,return total_length; } +static int query_hwconfig_table (struct drm_i915_private *i915, +struct drm_i915_query_item *query_item) +{ +struct intel_gt *gt = &i915->gt; +struct intel_guc_hwconfig *hwconfig = >->uc.guc.hwconfig; + +if (!hwconfig->size || !hwconfig->ptr) +return -ENODEV ; + +if (query_item->length ==0 ) +return hwconfig->size; + +if (query_item->length < hwconfig->size) +return -EINVAL ; + +if (copy_to_user (u64_to_user_ptr (query_item->data_ptr), + hwconfig->ptr, hwconfig->size)) +return -EFAULT ; + +return hwconfig->size; +} +static int (*const i915_query_funcs[])(struct drm_i915_private *dev_priv,struct drm_i915_query_item *query_item) = { query_topology_info, query_engine_info, query_perf_config, query_memregion_info, + query_hwconfig_table, };int i915_query_ioctl (struct drm_device *dev,void *data,struct drm_file *file)
include/uapi/drm/i915_drm.h +1 -0
@@ -2499,6 +2499,7 @@ struct drm_i915_query_item {#define DRM_I915_QUERY_ENGINE_INFO 2#define DRM_I915_QUERY_PERF_CONFIG 3#define DRM_I915_QUERY_MEMORY_REGIONS 4 +#define DRM_I915_QUERY_HWCONFIG_TABLE 5/* Must be kept compact -- no holes and well documented */ /**
Signature · 1 line
2.25.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Add support for querying hw info that UMDs need
In reply to [email protected]== Series Details ==
== Series Details ==
Series: Add support for querying hw info that UMDs need
URL : https://patchwork.freedesktop.org/series/94717/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 117fc7d59414 drm/i915/guc: Add fetch of hwconfig table -:97: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #97: new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 246 lines checked bc4c4902d357 drm/i915/uapi: Add query for hwconfig table
Patchwork
CI[Intel-gfx] ✗ Fi.CI.DOCS: warning for Add support for querying hw info that UMDs need
In reply to [email protected]== Series Details ==
== Series Details ==
Series: Add support for querying hw info that UMDs need
URL : https://patchwork.freedesktop.org/series/94717/
State : warning
== Summary ==
$ make htmldocs 2>&1 > /dev/null | grep i915 ./drivers/gpu/drm/i915/gt/uc/intel_guc.h:143: warning: Function parameter or member 'hwconfig' not described in 'intel_guc'
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for Add support for querying hw info that UMDs need
In reply to [email protected]== Series Details ==
== Series Details ==
Series: Add support for querying hw info that UMDs need
URL : https://patchwork.freedesktop.org/series/94717/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_10594 -> Patchwork_21068
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_21068 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_21068, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_21068:
### IGT changes ###
#### Possible regressions ####
* igt@i915_module_load@reload:
- fi-cfl-8700k: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10594/fi-cfl-8700k/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-cfl-8700k/igt@[email protected]
- fi-skl-6700k2: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10594/fi-skl-6700k2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-skl-6700k2/igt@[email protected]
- fi-kbl-guc: [PASS][5] -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10594/fi-kbl-guc/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-kbl-guc/igt@[email protected]
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@i915_module_load@reload:
- {fi-tgl-dsi}: [INCOMPLETE][7] ([i915#4136]) -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10594/fi-tgl-dsi/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-tgl-dsi/igt@[email protected]
Known issues
------------
Here are the changes found in Patchwork_21068 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_basic@cs-compute:
- fi-cfl-guc: NOTRUN -> [SKIP][9] ([fdo#109271]) +17 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-cfl-guc/igt@amdgpu/[email protected]
* igt@amdgpu/amd_basic@cs-gfx:
- fi-rkl-guc: NOTRUN -> [SKIP][10] ([fdo#109315]) +17 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-rkl-guc/igt@amdgpu/[email protected]
* igt@core_hotunplug@unbind-rebind:
- fi-rkl-11600: [PASS][11] -> [INCOMPLETE][12] ([i915#4130])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10594/fi-rkl-11600/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-rkl-11600/igt@[email protected]
* igt@runner@aborted:
- fi-cfl-8700k: NOTRUN -> [FAIL][13] ([i915#2426] / [i915#3363])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-cfl-8700k/igt@[email protected]
- fi-kbl-8809g: NOTRUN -> [FAIL][14] ([i915#2722] / [i915#3363])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-kbl-8809g/igt@[email protected]
- fi-skl-6700k2: NOTRUN -> [FAIL][15] ([i915#2426] / [i915#3363])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-skl-6700k2/igt@[email protected]
#### Possible fixes ####
* igt@core_hotunplug@unbind-rebind:
- fi-rkl-guc: [INCOMPLETE][16] ([i915#4130]) -> [PASS][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10594/fi-rkl-guc/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-rkl-guc/igt@[email protected]
- fi-cfl-guc: [INCOMPLETE][18] ([i915#4130]) -> [PASS][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10594/fi-cfl-guc/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-cfl-guc/igt@[email protected]
#### Warnings ####
* igt@i915_module_load@reload:
- fi-kbl-8809g: [INCOMPLETE][20] -> [INCOMPLETE][21] ([i915#4136])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10594/fi-kbl-8809g/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/fi-kbl-8809g/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
[i915#4130]: https://gitlab.freedesktop.org/drm/intel/issues/4130
[i915#4136]: https://gitlab.freedesktop.org/drm/intel/issues/4136
Participating hosts (39 -> 36)
------------------------------
Missing (3): fi-skl-guc fi-bdw-samus bat-dg1-6
Build changes
-------------
* IGT: IGT_6209 -> IGTPW_6222
* Linux: CI_DRM_10594 -> Patchwork_21068
CI-20190529: 20190529
CI_DRM_10594: b615e30a53680656e5b1f7670b34b1cac2a6be27 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_6222: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6222/index.html
IGT_6209: 07d6594ed02f55b68d64fa6dd7f80cfbc1ce4ef8 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21068: bc4c4902d357a60db2fc1483278625b1c90ab6e9 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
bc4c4902d357 drm/i915/uapi: Add query for hwconfig table 117fc7d59414 drm/i915/guc: Add fetch of hwconfig table
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21068/index.html