[PATCH] drm/amdgpu: unmap and remove csa_va properly

2023-05-06 Thread Lang Yu
Root PD BO should be reserved before unmap and remove
a bo_va from VM otherwise lockdep will complain.

[14616.936827] WARNING: CPU: 6 PID: 1711 at 
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1762 amdgpu_vm_bo_del+0x399/0x3f0 
[amdgpu]
[14616.937096] Call Trace:
[14616.937097]  
[14616.937102]  amdgpu_driver_postclose_kms+0x249/0x2f0 [amdgpu]
[14616.937187]  drm_file_free+0x1d6/0x300 [drm]
[14616.937207]  drm_close_helper.isra.0+0x62/0x70 [drm]
[14616.937220]  drm_release+0x5e/0x100 [drm]
[14616.937234]  __fput+0x9f/0x280
[14616.937239]  fput+0xe/0x20
[14616.937241]  task_work_run+0x61/0x90
[14616.937246]  exit_to_user_mode_prepare+0x215/0x220
[14616.937251]  syscall_exit_to_user_mode+0x2a/0x60
[14616.937254]  do_syscall_64+0x48/0x90
[14616.937257]  entry_SYSCALL_64_after_hwframe+0x63/0xcd

Signed-off-by: Lang Yu 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 38 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h |  3 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  9 +++---
 3 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
index c6d4d41c4393..23d054526e7c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
@@ -106,3 +106,41 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, 
struct amdgpu_vm *vm,
ttm_eu_backoff_reservation(&ticket, &list);
return 0;
 }
+
+int amdgpu_unmap_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
+   struct amdgpu_bo *bo, struct amdgpu_bo_va *bo_va,
+   uint64_t csa_addr)
+{
+   struct ww_acquire_ctx ticket;
+   struct list_head list;
+   struct amdgpu_bo_list_entry pd;
+   struct ttm_validate_buffer csa_tv;
+   int r;
+
+   INIT_LIST_HEAD(&list);
+   INIT_LIST_HEAD(&csa_tv.head);
+   csa_tv.bo = &bo->tbo;
+   csa_tv.num_shared = 1;
+
+   list_add(&csa_tv.head, &list);
+   amdgpu_vm_get_pd_bo(vm, &list, &pd);
+
+   r = ttm_eu_reserve_buffers(&ticket, &list, true, NULL);
+   if (r) {
+   DRM_ERROR("failed to reserve CSA,PD BOs: err=%d\n", r);
+   return r;
+   }
+
+   r = amdgpu_vm_bo_unmap(adev, bo_va, csa_addr);
+   if (r) {
+   DRM_ERROR("failed to do bo_unmap on static CSA, err=%d\n", r);
+   ttm_eu_backoff_reservation(&ticket, &list);
+   return r;
+   }
+
+   amdgpu_vm_bo_del(adev, bo_va);
+
+   ttm_eu_backoff_reservation(&ticket, &list);
+
+   return 0;
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h
index 524b4437a021..7dfc1f2012eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h
@@ -34,6 +34,9 @@ int amdgpu_allocate_static_csa(struct amdgpu_device *adev, 
struct amdgpu_bo **bo
 int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
  struct amdgpu_bo *bo, struct amdgpu_bo_va **bo_va,
  uint64_t csa_addr, uint32_t size);
+int amdgpu_unmap_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
+   struct amdgpu_bo *bo, struct amdgpu_bo_va *bo_va,
+   uint64_t csa_addr);
 void amdgpu_free_static_csa(struct amdgpu_bo **bo);
 
 #endif
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 1d3b224b8b28..6b47ac3eb40d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1307,11 +1307,10 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
amdgpu_vce_free_handles(adev, file_priv);
 
if (amdgpu_mcbp) {
-   /* TODO: how to handle reserve failure */
-   BUG_ON(amdgpu_bo_reserve(adev->virt.csa_obj, true));
-   amdgpu_vm_bo_del(adev, fpriv->csa_va);
-   fpriv->csa_va = NULL;
-   amdgpu_bo_unreserve(adev->virt.csa_obj);
+   uint64_t csa_addr = amdgpu_csa_vaddr(adev) & 
AMDGPU_GMC_HOLE_MASK;
+
+   WARN_ON(amdgpu_unmap_static_csa(adev, &fpriv->vm, 
adev->virt.csa_obj,
+   fpriv->csa_va, csa_addr));
}
 
pasid = fpriv->vm.pasid;
-- 
2.25.1



[linux-next:master] BUILD REGRESSION 83e5775d7afda68f6d7576d21f7a080fbfeecc4f

2023-05-06 Thread kernel test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
branch HEAD: 83e5775d7afda68f6d7576d21f7a080fbfeecc4f  Add linux-next specific 
files for 20230505

Error/Warning reports:

https://lore.kernel.org/oe-kbuild-all/202304102354.q4voxgte-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202304172004.r3iph5ja-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202304230014.ybscpx20-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202305042329.gyk53ked-...@intel.com

Error/Warning: (recently discovered and may have been fixed)

arch/arm64/mm/fixmap.c:187:10: warning: variable 'bm_pudp' set but not used 
[-Wunused-but-set-variable]
drivers/accel/habanalabs/gaudi/gaudi.c:117:19: warning: unused variable 
'gaudi_irq_name' [-Wunused-const-variable]
drivers/base/regmap/regcache-maple.c:113:23: warning: 'lower_index' is used 
uninitialized [-Wuninitialized]
drivers/base/regmap/regcache-maple.c:113:36: warning: 'lower_last' is used 
uninitialized [-Wuninitialized]
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:6339:6: warning: no 
previous prototype for 'amdgpu_dm_connector_funcs_force' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:6395:21: warning: 
variable 'count' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:494:13: warning: variable 'j' set but 
not used [-Wunused-but-set-variable]
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:48:38: warning: unused variable 
'golden_settings_gc_9_4_3' [-Wunused-const-variable]
drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h:62: warning: wrong kernel-doc 
identifier on line:
drivers/gpu/drm/i915/i915_pmu.h:41: warning: This comment starts with '/**', 
but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
drivers/gpu/drm/i915/i915_request.h:176: warning: This comment starts with 
'/**', but isn't a kernel-doc comment. Refer 
Documentation/doc-guide/kernel-doc.rst
drivers/gpu/drm/i915/i915_vma.h:145: warning: expecting prototype for 
i915_vma_offset(). Prototype was for i915_vma_size() instead
mm/gup.c:2813:14: error: implicit declaration of function 
'folio_fast_pin_allowed'; did you mean 'folio_test_pinned'? 
[-Werror=implicit-function-declaration]

Unverified Error/Warning (likely false positive, please contact us if 
interested):

drivers/cpufreq/pcc-cpufreq.c: linux/platform_device.h is included more than 
once.
fs/ext4/super.c:4722 ext4_check_feature_compatibility() warn: bitwise AND 
condition is false here

Error/Warning ids grouped by kconfigs:

gcc_recent_errors
|-- alpha-allyesconfig
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:no-previous-prototype-for-amdgpu_dm_connector_funcs_force
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:variable-count-set-but-not-used
|   `-- 
drivers-gpu-drm-amd-amdgpu-amdgpu_gfx.c:warning:variable-j-set-but-not-used
|-- alpha-randconfig-c043-20230430
|   `-- 
drivers-gpu-drm-amd-amdgpu-amdgpu_gfx.c:warning:variable-j-set-but-not-used
|-- arc-allyesconfig
|   |-- 
drivers-base-regmap-regcache-maple.c:warning:lower_index-is-used-uninitialized
|   |-- 
drivers-base-regmap-regcache-maple.c:warning:lower_last-is-used-uninitialized
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:no-previous-prototype-for-amdgpu_dm_connector_funcs_force
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:variable-count-set-but-not-used
|   `-- 
drivers-gpu-drm-amd-amdgpu-amdgpu_gfx.c:warning:variable-j-set-but-not-used
|-- arc-buildonly-randconfig-r001-20230430
|   |-- 
drivers-base-regmap-regcache-maple.c:warning:lower_index-is-used-uninitialized
|   `-- 
drivers-base-regmap-regcache-maple.c:warning:lower_last-is-used-uninitialized
|-- arc-randconfig-c024-20230430
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:no-previous-prototype-for-amdgpu_dm_connector_funcs_force
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:variable-count-set-but-not-used
|   `-- 
drivers-gpu-drm-amd-amdgpu-amdgpu_gfx.c:warning:variable-j-set-but-not-used
|-- arc-randconfig-r043-20230501
|   |-- 
drivers-base-regmap-regcache-maple.c:warning:lower_index-is-used-uninitialized
|   `-- 
drivers-base-regmap-regcache-maple.c:warning:lower_last-is-used-uninitialized
|-- arm-allmodconfig
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:no-previous-prototype-for-amdgpu_dm_connector_funcs_force
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:variable-count-set-but-not-used
|   `-- 
drivers-gpu-drm-amd-amdgpu-amdgpu_gfx.c:warning:variable-j-set-but-not-used
|-- arm-allyesconfig
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:no-previous-prototype-for-amdgpu_dm_connector_funcs_force
|   |-- 
drivers-gpu-drm-amd-amdgpu-..-display-amdgpu_dm-amdgpu_dm.c:warning:variable-count-set-but-not-used
|   `-- 
dri

[PATCH] drm/amdgpu: disable sdma ecc irq only when sdma RAS is enabled in suspend

2023-05-06 Thread Guchun Chen
sdma_v4_0_ip is shared on a few asics, but in sdma_v4_0_hw_fini,
driver unconditionally disables ecc_irq which is only enabled on
those asics enabling sdma ecc. This will introduce a warning in
suspend cycle on those chips with sdma ip v4.0, while without
sdma ecc. So this patch correct this.

[ 7283.166354] RIP: 0010:amdgpu_irq_put+0x45/0x70 [amdgpu]
[ 7283.167001] RSP: 0018:9a5fc3967d08 EFLAGS: 00010246
[ 7283.167019] RAX: 98d88afd3770 RBX: 0001 RCX: 
[ 7283.167023] RDX:  RSI: 98d89da30390 RDI: 98d89da2
[ 7283.167025] RBP: 98d89da2 R08: 00036838 R09: 0006
[ 7283.167028] R10: d5764243c008 R11:  R12: 98d89da30390
[ 7283.167030] R13: 98d89da38978 R14: 999ae15a R15: 98d880130105
[ 7283.167032] FS:  () GS:98d996f0() 
knlGS:
[ 7283.167036] CS:  0010 DS:  ES:  CR0: 80050033
[ 7283.167039] CR2: f7a9d178 CR3: 0001c42ea000 CR4: 003506e0
[ 7283.167041] Call Trace:
[ 7283.167046]  
[ 7283.167048]  sdma_v4_0_hw_fini+0x38/0xa0 [amdgpu]
[ 7283.167704]  amdgpu_device_ip_suspend_phase2+0x101/0x1a0 [amdgpu]
[ 7283.168296]  amdgpu_device_suspend+0x103/0x180 [amdgpu]
[ 7283.168875]  amdgpu_pmops_freeze+0x21/0x60 [amdgpu]
[ 7283.169464]  pci_pm_freeze+0x54/0xc0

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2522

Signed-off-by: Guchun Chen 
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index b5affba22156..8b8ddf050266 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -1903,9 +1903,11 @@ static int sdma_v4_0_hw_fini(void *handle)
return 0;
}
 
-   for (i = 0; i < adev->sdma.num_instances; i++) {
-   amdgpu_irq_put(adev, &adev->sdma.ecc_irq,
-  AMDGPU_SDMA_IRQ_INSTANCE0 + i);
+   if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__SDMA)) {
+   for (i = 0; i < adev->sdma.num_instances; i++) {
+   amdgpu_irq_put(adev, &adev->sdma.ecc_irq,
+  AMDGPU_SDMA_IRQ_INSTANCE0 + i);
+   }
}
 
sdma_v4_0_ctx_switch_enable(adev, false);
-- 
2.25.1



Re: [PATCH V2] drm/amdgpu/display: Enable DC_FP for LoongArch

2023-05-06 Thread Huacai Chen
Hi, Hamza,

On Fri, May 5, 2023 at 9:37 PM Hamza Mahfooz  wrote:
>
>
> Hey Huacai,
>
> On 5/5/23 07:32, Huacai Chen wrote:
> > Now LoongArch provides kernel_fpu_begin() and kernel_fpu_end() in commit
> > 2b3bd32ea3a22ea2d ("LoongArch: Provide kernel fpu functions"), so we can
> > enable DC_FP for DCN devices.
>
> Have you had the chance to test how well this is working on actual
> hardware, or was it only compile tested? If it was only compile tested,
> it would be great if you could run some tests. Please see the following
> for more details:
> https://lore.kernel.org/amd-gfx/8eb69dfb-ae35-dbf2-3f82-e8cc00e53...@amd.com/
I have tested hotplug, resolution changing and kms_flip in IGT, all of
them works fine.

Huacai
>
> >
> > Signed-off-by: WANG Xuerui 
> > Signed-off-by: Huacai Chen 
> > ---
> > V2: Update commit message to add the commit which provides kernel fpu
> >  functions.
> >
> >   drivers/gpu/drm/amd/display/Kconfig| 2 +-
> >   drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 6 --
> >   drivers/gpu/drm/amd/display/dc/dml/Makefile| 5 +
> >   3 files changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/Kconfig 
> > b/drivers/gpu/drm/amd/display/Kconfig
> > index 2d8e55e29637..49df073962d5 100644
> > --- a/drivers/gpu/drm/amd/display/Kconfig
> > +++ b/drivers/gpu/drm/amd/display/Kconfig
> > @@ -8,7 +8,7 @@ config DRM_AMD_DC
> >   depends on BROKEN || !CC_IS_CLANG || X86_64 || SPARC64 || ARM64
> >   select SND_HDA_COMPONENT if SND_HDA_CORE
> >   # !CC_IS_CLANG: https://github.com/ClangBuiltLinux/linux/issues/1752
> > - select DRM_AMD_DC_FP if (X86 || (PPC64 && ALTIVEC) || (ARM64 && 
> > KERNEL_MODE_NEON && !CC_IS_CLANG))
> > + select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || 
> > (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG))
> >   help
> > Choose this option if you want to use the new display engine
> > support for AMDGPU. This adds required support for Vega and
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c 
> > b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c
> > index 1743ca0a3641..86f4c0e04654 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c
> > @@ -33,6 +33,8 @@
> >   #include 
> >   #elif defined(CONFIG_ARM64)
> >   #include 
> > +#elif defined(CONFIG_LOONGARCH)
> > +#include 
> >   #endif
> >
> >   /**
> > @@ -88,7 +90,7 @@ void dc_fpu_begin(const char *function_name, const int 
> > line)
> >   *pcpu += 1;
> >
> >   if (*pcpu == 1) {
> > -#if defined(CONFIG_X86)
> > +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH)
> >   kernel_fpu_begin();
> >   #elif defined(CONFIG_PPC64)
> >   if (cpu_has_feature(CPU_FTR_VSX_COMP)) {
> > @@ -127,7 +129,7 @@ void dc_fpu_end(const char *function_name, const int 
> > line)
> >   pcpu = get_cpu_ptr(&fpu_recursion_depth);
> >   *pcpu -= 1;
> >   if (*pcpu <= 0) {
> > -#if defined(CONFIG_X86)
> > +#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH)
> >   kernel_fpu_end();
> >   #elif defined(CONFIG_PPC64)
> >   if (cpu_has_feature(CPU_FTR_VSX_COMP)) {
> > diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile 
> > b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> > index 01db035589c5..542962a93e8f 100644
> > --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
> > +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> > @@ -38,6 +38,11 @@ ifdef CONFIG_ARM64
> >   dml_rcflags := -mgeneral-regs-only
> >   endif
> >
> > +ifdef CONFIG_LOONGARCH
> > +dml_ccflags := -mfpu=64
> > +dml_rcflags := -msoft-float
> > +endif
> > +
> >   ifdef CONFIG_CC_IS_GCC
> >   ifneq ($(call gcc-min-version, 70100),y)
> >   IS_OLD_GCC = 1
> --
> Hamza
>


RE: [PATCH] drm/amdgpu: disable sdma ecc irq only when sdma RAS is enabled in suspend

2023-05-06 Thread Zhou1, Tao
[AMD Official Use Only - General]

Reviewed-by: Tao Zhou 

> -Original Message-
> From: Chen, Guchun 
> Sent: Saturday, May 6, 2023 5:04 PM
> To: amd-gfx@lists.freedesktop.org; Deucher, Alexander
> ; Zhang, Hawking ;
> Lazar, Lijo ; Zhou1, Tao ; Koenig,
> Christian 
> Cc: Chen, Guchun 
> Subject: [PATCH] drm/amdgpu: disable sdma ecc irq only when sdma RAS is
> enabled in suspend
> 
> sdma_v4_0_ip is shared on a few asics, but in sdma_v4_0_hw_fini, driver
> unconditionally disables ecc_irq which is only enabled on those asics enabling
> sdma ecc. This will introduce a warning in suspend cycle on those chips with
> sdma ip v4.0, while without sdma ecc. So this patch correct this.
> 
> [ 7283.166354] RIP: 0010:amdgpu_irq_put+0x45/0x70 [amdgpu] [ 7283.167001]
> RSP: 0018:9a5fc3967d08 EFLAGS: 00010246 [ 7283.167019] RAX:
> 98d88afd3770 RBX: 0001 RCX: 
> [ 7283.167023] RDX:  RSI: 98d89da30390 RDI:
> 98d89da2 [ 7283.167025] RBP: 98d89da2 R08:
> 00036838 R09: 0006 [ 7283.167028] R10:
> d5764243c008 R11:  R12: 98d89da30390
> [ 7283.167030] R13: 98d89da38978 R14: 999ae15a R15:
> 98d880130105 [ 7283.167032] FS:  ()
> GS:98d996f0() knlGS: [ 7283.167036] CS:  0010
> DS:  ES:  CR0: 80050033 [ 7283.167039] CR2:
> f7a9d178 CR3: 0001c42ea000 CR4: 003506e0
> [ 7283.167041] Call Trace:
> [ 7283.167046]  
> [ 7283.167048]  sdma_v4_0_hw_fini+0x38/0xa0 [amdgpu] [ 7283.167704]
> amdgpu_device_ip_suspend_phase2+0x101/0x1a0 [amdgpu] [ 7283.168296]
> amdgpu_device_suspend+0x103/0x180 [amdgpu] [ 7283.168875]
> amdgpu_pmops_freeze+0x21/0x60 [amdgpu] [ 7283.169464]
> pci_pm_freeze+0x54/0xc0
> 
> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2522
> 
> Signed-off-by: Guchun Chen 
> ---
>  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index b5affba22156..8b8ddf050266 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -1903,9 +1903,11 @@ static int sdma_v4_0_hw_fini(void *handle)
>   return 0;
>   }
> 
> - for (i = 0; i < adev->sdma.num_instances; i++) {
> - amdgpu_irq_put(adev, &adev->sdma.ecc_irq,
> -AMDGPU_SDMA_IRQ_INSTANCE0 + i);
> + if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__SDMA)) {
> + for (i = 0; i < adev->sdma.num_instances; i++) {
> + amdgpu_irq_put(adev, &adev->sdma.ecc_irq,
> +AMDGPU_SDMA_IRQ_INSTANCE0 + i);
> + }
>   }
> 
>   sdma_v4_0_ctx_switch_enable(adev, false);
> --
> 2.25.1


[PATCH] drm/amdgpu: Remove the unused variable golden_settings_gc_9_4_3

2023-05-06 Thread Jiapeng Chong
Variable golden_settings_gc_9_4_3 is not effectively used, so delete it.

drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:48:38: warning: 
‘golden_settings_gc_9_4_3’ defined but not used.

Reported-by: Abaci Robot 
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4877
Signed-off-by: Jiapeng Chong 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index 312491455382..74be46d382f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
@@ -45,10 +45,6 @@ MODULE_FIRMWARE("amdgpu/gc_9_4_3_rlc.bin");
 #define GFX9_MEC_HPD_SIZE 4096
 #define RLCG_UCODE_LOADING_START_ADDRESS 0x2000L
 
-static const struct soc15_reg_golden golden_settings_gc_9_4_3[] = {
-
-};
-
 static void gfx_v9_4_3_set_ring_funcs(struct amdgpu_device *adev);
 static void gfx_v9_4_3_set_irq_funcs(struct amdgpu_device *adev);
 static void gfx_v9_4_3_set_gds_init(struct amdgpu_device *adev);
-- 
2.20.1.7.g153144c



Re: Is "perfectly equal monitors" really required to reclock MCLK

2023-05-06 Thread Braiam
On Fri, Jan 13, 2023 at 11:22 AM Christian König
 wrote:
> Totally, as far as I know VRR is currently a complete show stopper for
> reclocking the MCLK.
>
> But on the other hand VRR could potentially be used to artificially
> create some overlapping VBLANK period to do the actually reclocking.
> Interesting idea.
>
> We might want to ping Harry or somebody else form the DC team if they
> have thought about that yet.

Did you hear from them? I feel like I'm wasting a feature of my two screens
by not using VRR.

-- 
Braiam


[PATCH] drm/amdgpu/gfx: disable cp_ecc_error_irq only when gfx ras is enabled in suspend

2023-05-06 Thread Guchun Chen
cp_ecc_error_irq is only enabled when gfx ras is assert.
So in gfx_v9_0_hw_fini, interrupt disablement for cp_ecc_error_irq
should be executed under such condition, otherwise, an amdgpu_irq_put
calltrace will occur.

[ 7283.170322] RIP: 0010:amdgpu_irq_put+0x45/0x70 [amdgpu]
[ 7283.170964] RSP: 0018:9a5fc3967d00 EFLAGS: 00010246
[ 7283.170967] RAX: 98d88afd3040 RBX: 98d89da2 RCX: 
[ 7283.170969] RDX:  RSI: 98d89da2bef8 RDI: 98d89da2
[ 7283.170971] RBP: 98d89da2 R08: 98d89da2ca18 R09: 0006
[ 7283.170973] R10: d5764243c008 R11:  R12: 1050
[ 7283.170975] R13: 98d89da38978 R14: 999ae15a R15: 98d880130105
[ 7283.170978] FS:  () GS:98d996f0() 
knlGS:
[ 7283.170981] CS:  0010 DS:  ES:  CR0: 80050033
[ 7283.170983] CR2: f7a9d178 CR3: 0001c42ea000 CR4: 003506e0
[ 7283.170986] Call Trace:
[ 7283.170988]  
[ 7283.170989]  gfx_v9_0_hw_fini+0x1c/0x6d0 [amdgpu]
[ 7283.171655]  amdgpu_device_ip_suspend_phase2+0x101/0x1a0 [amdgpu]
[ 7283.172245]  amdgpu_device_suspend+0x103/0x180 [amdgpu]
[ 7283.172823]  amdgpu_pmops_freeze+0x21/0x60 [amdgpu]
[ 7283.173412]  pci_pm_freeze+0x54/0xc0
[ 7283.173419]  ? __pfx_pci_pm_freeze+0x10/0x10
[ 7283.173425]  dpm_run_callback+0x98/0x200
[ 7283.173430]  __device_suspend+0x164/0x5f0

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2522

Signed-off-by: Guchun Chen 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index ecf8ceb53311..f6bc62a94099 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -4442,7 +4442,8 @@ static int gfx_v11_0_hw_fini(void *handle)
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
int r;
 
-   amdgpu_irq_put(adev, &adev->gfx.cp_ecc_error_irq, 0);
+   if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX))
+   amdgpu_irq_put(adev, &adev->gfx.cp_ecc_error_irq, 0);
amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0);
amdgpu_irq_put(adev, &adev->gfx.priv_inst_irq, 0);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index ae09fc1cfe6b..c54d05bdc2d8 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -3751,7 +3751,8 @@ static int gfx_v9_0_hw_fini(void *handle)
 {
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-   amdgpu_irq_put(adev, &adev->gfx.cp_ecc_error_irq, 0);
+   if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX))
+   amdgpu_irq_put(adev, &adev->gfx.cp_ecc_error_irq, 0);
amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0);
amdgpu_irq_put(adev, &adev->gfx.priv_inst_irq, 0);
 
-- 
2.25.1