From ef668f3714112e665a42b63dc971b0fe266547d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Mon, 23 Jan 2023 17:11:36 +0100 Subject: [PATCH] ac/gpu_info: Add has_pcie_bandwidth_info. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is so that we can tell whether the current kernel has the PCIe bandwidth info available or not. Signed-off-by: Timur Kristóf Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/common/ac_gpu_info.c | 3 ++- src/amd/common/ac_gpu_info.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c index 5766bcd96e0..14bd478c6e8 100644 --- a/src/amd/common/ac_gpu_info.c +++ b/src/amd/common/ac_gpu_info.c @@ -1355,8 +1355,9 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info) info->num_rb = util_bitcount(info->enabled_rb_mask); info->max_gflops = (info->gfx_level >= GFX11 ? 256 : 128) * info->num_cu * info->max_gpu_freq_mhz / 1000; info->memory_bandwidth_gbps = DIV_ROUND_UP(info->memory_freq_mhz_effective * info->memory_bus_width / 8, 1000); + info->has_pcie_bandwidth_info = info->drm_minor >= 51; - if (info->drm_minor >= 51) { + if (info->has_pcie_bandwidth_info) { info->pcie_gen = device_info.pcie_gen; info->pcie_num_lanes = device_info.pcie_num_lanes; diff --git a/src/amd/common/ac_gpu_info.h b/src/amd/common/ac_gpu_info.h index 87aa7da6aee..76aa6b27e9d 100644 --- a/src/amd/common/ac_gpu_info.h +++ b/src/amd/common/ac_gpu_info.h @@ -200,6 +200,7 @@ struct radeon_info { bool has_sparse_vm_mappings; bool has_scheduled_fence_dependency; bool has_gang_submit; + bool has_pcie_bandwidth_info; bool has_stable_pstate; /* Whether SR-IOV is enabled or amdgpu.mcbp=1 was set on the kernel command line. */ bool mid_command_buffer_preemption_enabled;