From 7d4c91efef3851664a44110012947f9d15251499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Tue, 12 Nov 2024 10:34:36 -0800 Subject: [PATCH] intel/dev: Call intel_device_info_update_after_hwconfig() from common code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid backends duplication. Reviewed-by: Lionel Landwerlin Signed-off-by: José Roberto de Souza Part-of: --- src/intel/dev/i915/intel_device_info.c | 3 +-- src/intel/dev/intel_device_info.c | 22 ++++++++++++---------- src/intel/dev/intel_device_info.h | 1 - src/intel/dev/intel_hwconfig.c | 10 +++++----- src/intel/dev/intel_hwconfig.h | 3 +++ src/intel/dev/xe/intel_device_info.c | 4 ++-- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/intel/dev/i915/intel_device_info.c b/src/intel/dev/i915/intel_device_info.c index 18ed1222e03..2fdfa05de0b 100644 --- a/src/intel/dev/i915/intel_device_info.c +++ b/src/intel/dev/i915/intel_device_info.c @@ -579,8 +579,7 @@ bool intel_device_info_i915_get_info_from_fd(int fd, struct intel_device_info *d hwconfig_blob = intel_device_info_i915_query_hwconfig(fd, &len); if (hwconfig_blob) { - if (intel_hwconfig_process_table(devinfo, hwconfig_blob, len)) - intel_device_info_update_after_hwconfig(devinfo); + intel_hwconfig_process_table(devinfo, hwconfig_blob, len); free(hwconfig_blob); } diff --git a/src/intel/dev/intel_device_info.c b/src/intel/dev/intel_device_info.c index 318ced292de..fba2d2109d0 100644 --- a/src/intel/dev/intel_device_info.c +++ b/src/intel/dev/intel_device_info.c @@ -1849,6 +1849,16 @@ intel_device_info_calc_engine_prefetch(const struct intel_device_info *devinfo, return 512; } +static void +intel_device_info_update_after_hwconfig(struct intel_device_info *devinfo) +{ + /* After applying hwconfig values, some items need to be recalculated. */ + devinfo->max_cs_threads = + devinfo->max_eus_per_subslice * devinfo->num_thread_per_eu; + + intel_device_info_update_cs_workgroup_threads(devinfo); +} + bool intel_get_device_info_from_fd(int fd, struct intel_device_info *devinfo, int min_ver, int max_ver) { @@ -1943,6 +1953,8 @@ intel_get_device_info_from_fd(int fd, struct intel_device_info *devinfo, int min return false; } + if (intel_hwconfig_is_required(devinfo)) + intel_device_info_update_after_hwconfig(devinfo); intel_device_info_adjust_memory(devinfo); /* Gfx7 and older do not support EU/Subslice info */ @@ -1984,16 +1996,6 @@ bool intel_device_info_update_memory_info(struct intel_device_info *devinfo, int return ret; } -void -intel_device_info_update_after_hwconfig(struct intel_device_info *devinfo) -{ - /* After applying hwconfig values, some items need to be recalculated. */ - devinfo->max_cs_threads = - devinfo->max_eus_per_subslice * devinfo->num_thread_per_eu; - - intel_device_info_update_cs_workgroup_threads(devinfo); -} - enum intel_wa_steppings intel_device_info_wa_stepping(struct intel_device_info *devinfo) { diff --git a/src/intel/dev/intel_device_info.h b/src/intel/dev/intel_device_info.h index 784646a9e96..f8e13eaece4 100644 --- a/src/intel/dev/intel_device_info.h +++ b/src/intel/dev/intel_device_info.h @@ -199,7 +199,6 @@ void intel_device_info_update_l3_banks(struct intel_device_info *devinfo); uint32_t intel_device_info_get_eu_count_first_subslice(const struct intel_device_info *devinfo); void intel_device_info_update_cs_workgroup_threads(struct intel_device_info *devinfo); bool intel_device_info_compute_system_memory(struct intel_device_info *devinfo, bool update); -void intel_device_info_update_after_hwconfig(struct intel_device_info *devinfo); #ifdef GFX_VERx10 #define intel_needs_workaround(devinfo, id) \ diff --git a/src/intel/dev/intel_hwconfig.c b/src/intel/dev/intel_hwconfig.c index 7c66943b66b..28fadbdeac6 100644 --- a/src/intel/dev/intel_hwconfig.c +++ b/src/intel/dev/intel_hwconfig.c @@ -147,8 +147,8 @@ process_hwconfig_table(struct intel_device_info *devinfo, assert(current == end); } -static inline bool -apply_hwconfig(const struct intel_device_info *devinfo) +bool +intel_hwconfig_is_required(const struct intel_device_info *devinfo) { /* returns is true when the platform should apply hwconfig values */ return devinfo->verx10 >= 125; @@ -172,7 +172,7 @@ should_apply_hwconfig_item(uint16_t always_apply_verx10, const struct intel_device_info *devinfo, uint32_t devinfo_val) { - assert(apply_hwconfig(devinfo)); + assert(intel_hwconfig_is_required(devinfo)); if ((devinfo->verx10 >= always_apply_verx10 || devinfo_val == 0)) return true; @@ -337,10 +337,10 @@ bool intel_hwconfig_process_table(struct intel_device_info *devinfo, void *data, int32_t len) { - if (apply_hwconfig(devinfo)) + if (intel_hwconfig_is_required(devinfo)) process_hwconfig_table(devinfo, data, len, apply_hwconfig_item); - return apply_hwconfig(devinfo); + return true; } static void diff --git a/src/intel/dev/intel_hwconfig.h b/src/intel/dev/intel_hwconfig.h index a9854188b30..9537504d63e 100644 --- a/src/intel/dev/intel_hwconfig.h +++ b/src/intel/dev/intel_hwconfig.h @@ -42,6 +42,9 @@ intel_check_hwconfig_items(int fd, struct intel_device_info *devinfo); void intel_get_and_print_hwconfig_table(int fd, struct intel_device_info *devinfo); +bool +intel_hwconfig_is_required(const struct intel_device_info *devinfo); + #ifdef __cplusplus } #endif diff --git a/src/intel/dev/xe/intel_device_info.c b/src/intel/dev/xe/intel_device_info.c index a497cbfe63b..f5e33cbd1a0 100644 --- a/src/intel/dev/xe/intel_device_info.c +++ b/src/intel/dev/xe/intel_device_info.c @@ -346,8 +346,8 @@ intel_device_info_xe_get_info_from_fd(int fd, struct intel_device_info *devinfo) if (!xe_query_topology(fd, devinfo)) return false; - if (xe_query_process_hwconfig(fd, devinfo)) - intel_device_info_update_after_hwconfig(devinfo); + if (!xe_query_process_hwconfig(fd, devinfo)) + return false; devinfo->has_context_isolation = true; devinfo->has_mmap_offset = true;