From nobody Thu Dec 18 21:12:38 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20991C71153 for ; Thu, 24 Aug 2023 16:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242519AbjHXQZp (ORCPT ); Thu, 24 Aug 2023 12:25:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242560AbjHXQZZ (ORCPT ); Thu, 24 Aug 2023 12:25:25 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 980F71736 for ; Thu, 24 Aug 2023 09:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3/0b7JXGS9XrZOsXFanYgxYNoT+LwI1FiFNHzgEUytE=; b=mWaPQckYc4uemicdtao+9SFjpk ETgaE5ADGTuvH9gxzLVXfJrBdQUuRn905awg5gNRKYhuLIKePXG8uvGp1cH9DnyF1uUOgR0f8vJgL u+hM2F2JvDrGV8XL+Ldq2Ssjr9lMtD+HE9xX8COkalEKZjb3yjIuHjo51y69XPFVBk//fzmiXWmMc 0xJ3TCvW6YQMNgodbp+wvfIUOIPpNs+foRZRSDhdpy2moC4RfqtHlblRsvmHT2UxLbJTcyLnWnKAs ffM83PD1PXREhdw5lFvaCgLw1bP9UnsU2OiCTf2MV8fqZ7ReI+ReIZUrMLFaX4YzPqHVCfZkKPnPd 5ThAG3QQ==; Received: from [187.35.42.59] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1qZD97-00F0DK-EZ; Thu, 24 Aug 2023 18:25:21 +0200 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com, pierre-eric.pelloux-prayer@amd.com, =?UTF-8?q?=27Marek=20Ol=C5=A1=C3=A1k=27?= , =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH 1/2] drm/amdgpu: Merge debug module parameters Date: Thu, 24 Aug 2023 13:25:04 -0300 Message-ID: <20230824162505.173399-2-andrealmeid@igalia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230824162505.173399-1-andrealmeid@igalia.com> References: <20230824162505.173399-1-andrealmeid@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Merge all developer debug options available as separated module parameters in one, making it obvious that are for developers. Signed-off-by: Andr=C3=A9 Almeida --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/amd/include/amd_shared.h | 9 +++++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_drv.c index f5856b82605e..d53e4097acc0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -194,6 +194,7 @@ int amdgpu_use_xgmi_p2p =3D 1; int amdgpu_vcnfw_log; int amdgpu_sg_display =3D -1; /* auto */ int amdgpu_user_partt_mode =3D AMDGPU_AUTO_COMPUTE_PARTITION_MODE; +uint amdgpu_debug_mask; =20 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work= ); =20 @@ -938,6 +939,9 @@ module_param_named(user_partt_mode, amdgpu_user_partt_m= ode, uint, 0444); module_param(enforce_isolation, bool, 0444); MODULE_PARM_DESC(enforce_isolation, "enforce process isolation between gra= phics and compute . enforce_isolation =3D on"); =20 +MODULE_PARM_DESC(debug_mask, "debug options for amdgpu, disabled by defaul= t"); +module_param_named(debug_mask, amdgpu_debug_mask, uint, 0444); + /* These devices are not supported by amdgpu. * They are supported by the mach64, r128, radeon drivers */ @@ -2871,6 +2875,24 @@ static struct pci_driver amdgpu_kms_pci_driver =3D { .dev_groups =3D amdgpu_sysfs_groups, }; =20 +static void amdgpu_init_debug_options(void) +{ + if (amdgpu_debug_mask & DEBUG_VERBOSE_EVICTIONS) { + pr_info("debug: eviction debug messages enabled\n"); + debug_evictions =3D true; + } + + if (amdgpu_debug_mask & DEBUG_VM) { + pr_info("debug: VM handling debug enabled\n"); + amdgpu_vm_debug =3D true; + } + + if (amdgpu_debug_mask & DEBUG_LARGEBAR) { + pr_info("debug: enabled simulating large-bar capability on non-large bar= system\n"); + debug_largebar =3D true; + } +} + static int __init amdgpu_init(void) { int r; @@ -2893,6 +2915,8 @@ static int __init amdgpu_init(void) /* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */ amdgpu_amdkfd_init(); =20 + amdgpu_init_debug_options(); + /* let modprobe override vga console setting */ return pci_register_driver(&amdgpu_kms_pci_driver); =20 diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd= /include/amd_shared.h index 67d7b7ee8a2a..6fa644c249a5 100644 --- a/drivers/gpu/drm/amd/include/amd_shared.h +++ b/drivers/gpu/drm/amd/include/amd_shared.h @@ -257,6 +257,15 @@ enum DC_DEBUG_MASK { =20 enum amd_dpm_forced_level; =20 +/* + * amdgpu.debug module options. Are all disabled by default + */ +enum AMDGPU_DEBUG_MASK { + DEBUG_VERBOSE_EVICTIONS =3D (1 << 0), // 0x1 + DEBUG_VM =3D (1 << 1), // 0x2 + DEBUG_LARGEBAR =3D (1 << 2), // 0x4 +}; + /** * struct amd_ip_funcs - general hooks for managing amdgpu IP Blocks * @name: Name of IP block --=20 2.41.0