From 3da8b46eba526ded6c94691d4dfa7529b5267c19 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Tue, 22 Oct 2024 15:36:13 -0700 Subject: [PATCH] intel/dev: Allow specifying a version when to always use hwconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport-to: 24.2 Signed-off-by: Jordan Justen Reviewed-by: José Roberto de Souza Part-of: (cherry picked from commit 7b86da0ccdb5e56d8907a69c20d1492609c0aea3) --- .pick_status.json | 2 +- src/intel/dev/intel_hwconfig.c | 37 ++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f27246769c2..7eb2a37bdb8 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1414,7 +1414,7 @@ "description": "intel/dev: Allow specifying a version when to always use hwconfig", "nominated": true, "nomination_type": 4, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/dev/intel_hwconfig.c b/src/intel/dev/intel_hwconfig.c index 1a4403ccd2e..3e15f6ed0ec 100644 --- a/src/intel/dev/intel_hwconfig.c +++ b/src/intel/dev/intel_hwconfig.c @@ -155,12 +155,14 @@ apply_hwconfig(const struct intel_device_info *devinfo) } static inline bool -should_apply_hwconfig_item(const struct intel_device_info *devinfo, +should_apply_hwconfig_item(uint16_t always_apply_verx10, + const struct intel_device_info *devinfo, const char *devinfo_name, uint32_t devinfo_val, const uint32_t hwconfig_key, uint32_t hwconfig_val) { - if (apply_hwconfig(devinfo)) - return true; + if (apply_hwconfig(devinfo) && + (devinfo->verx10 >= always_apply_verx10 || devinfo_val == 0)) + return true; #ifndef NDEBUG if (devinfo_val != hwconfig_val) { @@ -180,15 +182,20 @@ should_apply_hwconfig_item(const struct intel_device_info *devinfo, * hwconfig value, ``V``, with the current value in ``F`` and log a warning * message if they differ. This should help to make sure the values in our * devinfo structures match what hwconfig is specified. + * + * If ``devinfo->verx10 >= CVER``, then the hwconfig value is always be used. + * If ``devinfo->verx10 < CVER``, the hwconfig value is only used if + * devinfo->F is 0. */ -#define DEVINFO_HWCONFIG_KV(F, K, V) \ +#define DEVINFO_HWCONFIG_KV(CVER, F, K, V) \ do { \ - if (should_apply_hwconfig_item(devinfo, #F, devinfo->F, (K), \ - (V))) \ + if (should_apply_hwconfig_item((CVER), devinfo, #F, devinfo->F, \ + (K), (V))) \ devinfo->F = (V); \ } while (0) -#define DEVINFO_HWCONFIG(F, I) DEVINFO_HWCONFIG_KV(F, (I)->key, (I)->val[0]) +#define DEVINFO_HWCONFIG(CVER, F, I) \ + DEVINFO_HWCONFIG_KV((CVER), F, (I)->key, (I)->val[0]) static void apply_hwconfig_item(struct intel_device_info *devinfo, @@ -210,22 +217,22 @@ apply_hwconfig_item(struct intel_device_info *devinfo, case INTEL_HWCONFIG_DEPRECATED_SLM_SIZE_IN_KB: break; /* ignore */ case INTEL_HWCONFIG_MAX_NUM_EU_PER_DSS: - DEVINFO_HWCONFIG(max_eus_per_subslice, item); + DEVINFO_HWCONFIG(125, max_eus_per_subslice, item); break; case INTEL_HWCONFIG_NUM_THREADS_PER_EU: - DEVINFO_HWCONFIG(num_thread_per_eu, item); + DEVINFO_HWCONFIG(125, num_thread_per_eu, item); break; case INTEL_HWCONFIG_TOTAL_VS_THREADS: - DEVINFO_HWCONFIG(max_vs_threads, item); + DEVINFO_HWCONFIG(125, max_vs_threads, item); break; case INTEL_HWCONFIG_TOTAL_GS_THREADS: - DEVINFO_HWCONFIG(max_gs_threads, item); + DEVINFO_HWCONFIG(125, max_gs_threads, item); break; case INTEL_HWCONFIG_TOTAL_HS_THREADS: - DEVINFO_HWCONFIG(max_tcs_threads, item); + DEVINFO_HWCONFIG(125, max_tcs_threads, item); break; case INTEL_HWCONFIG_TOTAL_DS_THREADS: - DEVINFO_HWCONFIG(max_tes_threads, item); + DEVINFO_HWCONFIG(125, max_tes_threads, item); break; case INTEL_HWCONFIG_TOTAL_VS_THREADS_POCS: break; /* ignore */ @@ -233,11 +240,11 @@ apply_hwconfig_item(struct intel_device_info *devinfo, unsigned threads = item->val[0]; if (devinfo->ver == 12) threads /= 2; - DEVINFO_HWCONFIG_KV(max_threads_per_psd, item->key, threads); + DEVINFO_HWCONFIG_KV(125, max_threads_per_psd, item->key, threads); break; } case INTEL_HWCONFIG_URB_SIZE_PER_SLICE_IN_KB: - DEVINFO_HWCONFIG(urb.size, item); + DEVINFO_HWCONFIG(125, urb.size, item); break; case INTEL_HWCONFIG_DEPRECATED_MAX_FILL_RATE: case INTEL_HWCONFIG_MAX_RCS: