Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 34CCBC3ABAA for ; Wed, 30 Apr 2025 06:28:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC35210E28E; Wed, 30 Apr 2025 06:28:44 +0000 (UTC) Received: from amd-X570-AORUS-ELITE.amd.com (unknown [165.204.156.251]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99C4910E28E for ; Wed, 30 Apr 2025 06:28:43 +0000 (UTC) Received: by amd-X570-AORUS-ELITE.amd.com (Postfix, from userid 1000) id A80A236A0007; Wed, 30 Apr 2025 11:58:39 +0530 (IST) From: Sunil Khatri To: igt-dev@lists.freedesktop.org, Vitaly Prosyak Cc: Sunil Khatri , "Prosyak@sunil.khatri"@amd.com, Vitaly , Jesse Zhang Subject: [PATCH v3 2/4] lib/amdgpu: add func to read the userqueue support Date: Wed, 30 Apr 2025 11:58:33 +0530 Message-ID: <20250430062835.348074-2-sunil.khatri@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250430062835.348074-1-sunil.khatri@amd.com> References: <20250430062835.348074-1-sunil.khatri@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" The function asic_userq_readiness read the userq_ip_mask value set by the kernel which says which ip supports userqueues on this asic. Cc: Prosyak, Vitaly Cc: Jesse Zhang Signed-off-by: Sunil Khatri --- lib/amdgpu/amd_ip_blocks.c | 17 +++++++++++++++++ lib/amdgpu/amd_ip_blocks.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/lib/amdgpu/amd_ip_blocks.c b/lib/amdgpu/amd_ip_blocks.c index d6764194d..b8227ba2b 100644 --- a/lib/amdgpu/amd_ip_blocks.c +++ b/lib/amdgpu/amd_ip_blocks.c @@ -976,6 +976,23 @@ is_rings_available(amdgpu_device_handle device_handle, uint32_t mask, return hw_ip_info.available_rings & mask; } +void asic_userq_readiness(amdgpu_device_handle device_handle, bool arr[AMD_IP_MAX]) +{ + int r, i; + enum amd_ip_block_type ip; + struct drm_amdgpu_info_device dev_info = {0}; + + r = amdgpu_query_info(device_handle, AMDGPU_INFO_DEV_INFO, + sizeof(dev_info), &dev_info); + igt_assert_eq(r, 0); + + if (!dev_info.userq_ip_mask) + return; + + for (i = 0, ip = AMD_IP_GFX; ip < AMD_IP_MAX; ip++) + arr[i++] = dev_info.userq_ip_mask & (1 << ip); +} + /** * asic_rings_readness: * @device handle: handle to driver internal information diff --git a/lib/amdgpu/amd_ip_blocks.h b/lib/amdgpu/amd_ip_blocks.h index 7d48f9107..3c2ecd1ba 100644 --- a/lib/amdgpu/amd_ip_blocks.h +++ b/lib/amdgpu/amd_ip_blocks.h @@ -268,6 +268,8 @@ amdgpu_open_devices(bool open_render_node, int max_cards_supported, int drm_amdg void asic_rings_readness(amdgpu_device_handle device_handle, uint32_t mask, bool arr[AMD_IP_MAX]); +void asic_userq_readiness(amdgpu_device_handle device_handle, bool arr[AMD_IP_MAX]); + bool is_reset_enable(enum amd_ip_block_type ip_type, uint32_t reset_type, const struct pci_addr *pci); -- 2.43.0