Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/amd amdgpu: mutex_init/destro...



details:   https://anonhg.NetBSD.org/src/rev/492f985b11fd
branches:  trunk
changeset: 1028939:492f985b11fd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:31:45 2021 +0000

description:
amdgpu: mutex_init/destroy and spin_lock_init/destroy audit

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c                |   5 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c             |  12 +++++-----
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx.c                |   5 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v10_0.c          |   6 +++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v9_0.c           |   6 +++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_irq.c                |   6 +++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ras.c                |   8 +++---
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ras_eeprom.c         |   6 +++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ring.c               |   6 +++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c                |   5 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c                 |   8 +++++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vram_mgr.c           |   5 ++-
 sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm.c      |   5 ++-
 sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c |   5 ++-
 sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c  |   6 +++-
 sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_amd_powerplay.c   |   5 ++-
 sys/external/bsd/drm2/dist/drm/amd/powerplay/amdgpu_smu.c             |  10 ++++++-
 17 files changed, 69 insertions(+), 40 deletions(-)

diffs (truncated from 491 to 300 lines):

diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c    Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c    Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_ctx.c,v 1.6 2021/12/18 23:44:58 riastradh Exp $ */
+/*     $NetBSD: amdgpu_ctx.c,v 1.7 2021/12/19 12:31:45 riastradh Exp $ */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ctx.c,v 1.6 2021/12/18 23:44:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ctx.c,v 1.7 2021/12/19 12:31:45 riastradh Exp $");
 
 #include <drm/drm_auth.h>
 #include "amdgpu.h"
@@ -201,6 +201,7 @@
        }
 
        mutex_destroy(&ctx->lock);
+       spin_lock_destroy(&ctx->ring_lock);
        kfree(ctx);
 }
 
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_device.c,v 1.10 2021/12/19 12:01:12 riastradh Exp $     */
+/*     $NetBSD: amdgpu_device.c,v 1.11 2021/12/19 12:31:45 riastradh Exp $     */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *          Jerome Glisse
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.10 2021/12/19 12:01:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.11 2021/12/19 12:31:45 riastradh Exp $");
 
 #include <linux/power_supply.h>
 #include <linux/kthread.h>
@@ -2972,10 +2972,6 @@
        mutex_init(&adev->psp.mutex);
        mutex_init(&adev->notifier_lock);
 
-       r = amdgpu_device_check_arguments(adev);
-       if (r)
-               return r;
-
        spin_lock_init(&adev->mmio_idx_lock);
        spin_lock_init(&adev->smc_idx_lock);
        spin_lock_init(&adev->pcie_idx_lock);
@@ -2999,6 +2995,10 @@
 
        INIT_WORK(&adev->xgmi_reset_work, amdgpu_device_xgmi_reset_func);
 
+       r = amdgpu_device_check_arguments(adev);
+       if (r)
+               return r;
+
        adev->gfx.gfx_off_req_count = 1;
        adev->pm.ac_power = power_supply_is_system_supplied() > 0 ? true : false;
 
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx.c    Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx.c    Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_gfx.c,v 1.5 2021/12/19 12:02:13 riastradh Exp $ */
+/*     $NetBSD: amdgpu_gfx.c,v 1.6 2021/12/19 12:31:45 riastradh Exp $ */
 
 /*
  * Copyright 2014 Advanced Micro Devices, Inc.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gfx.c,v 1.5 2021/12/19 12:02:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gfx.c,v 1.6 2021/12/19 12:31:45 riastradh Exp $");
 
 #include "amdgpu.h"
 #include "amdgpu_gfx.h"
@@ -328,6 +328,7 @@
 {
        amdgpu_device_wb_free(ring->adev, ring->adev->gfx.kiq.reg_val_offs);
        amdgpu_ring_fini(ring);
+       spin_lock_destroy(&ring->adev->gfx.kiq.ring_lock);
 }
 
 void amdgpu_gfx_kiq_fini(struct amdgpu_device *adev)
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v10_0.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v10_0.c      Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v10_0.c      Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_gmc_v10_0.c,v 1.4 2021/12/19 12:21:29 riastradh Exp $   */
+/*     $NetBSD: amdgpu_gmc_v10_0.c,v 1.5 2021/12/19 12:31:45 riastradh Exp $   */
 
 /*
  * Copyright 2019 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gmc_v10_0.c,v 1.4 2021/12/19 12:21:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gmc_v10_0.c,v 1.5 2021/12/19 12:31:45 riastradh Exp $");
 
 #include <linux/firmware.h>
 #include <linux/pci.h>
@@ -884,6 +884,8 @@
        amdgpu_gem_force_release(adev);
        amdgpu_bo_fini(adev);
 
+       spin_lock_destroy(&adev->gmc.invalidate_lock);
+
        return 0;
 }
 
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v9_0.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v9_0.c       Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v9_0.c       Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_gmc_v9_0.c,v 1.4 2021/12/19 12:21:29 riastradh Exp $    */
+/*     $NetBSD: amdgpu_gmc_v9_0.c,v 1.5 2021/12/19 12:31:45 riastradh Exp $    */
 
 /*
  * Copyright 2016 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gmc_v9_0.c,v 1.4 2021/12/19 12:21:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gmc_v9_0.c,v 1.5 2021/12/19 12:31:45 riastradh Exp $");
 
 #include <linux/firmware.h>
 #include <linux/pci.h>
@@ -1252,6 +1252,8 @@
        amdgpu_bo_fini(adev);
        amdgpu_gart_fini(adev);
 
+       spin_lock_destroy(&adev->gmc.invalidate_lock);
+
        return 0;
 }
 
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_irq.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_irq.c    Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_irq.c    Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_irq.c,v 1.7 2021/12/19 12:23:16 riastradh Exp $ */
+/*     $NetBSD: amdgpu_irq.c,v 1.8 2021/12/19 12:31:45 riastradh Exp $ */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_irq.c,v 1.7 2021/12/19 12:23:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_irq.c,v 1.8 2021/12/19 12:31:45 riastradh Exp $");
 
 #include <linux/irq.h>
 #include <linux/pci.h>
@@ -353,6 +353,8 @@
                kfree(adev->irq.client[i].sources);
                adev->irq.client[i].sources = NULL;
        }
+
+       spin_lock_destroy(&adev->irq.lock);
 }
 
 /**
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ras.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ras.c    Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ras.c    Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_ras.c,v 1.4 2021/12/19 12:23:16 riastradh Exp $ */
+/*     $NetBSD: amdgpu_ras.c,v 1.5 2021/12/19 12:31:45 riastradh Exp $ */
 
 /*
  * Copyright 2018 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ras.c,v 1.4 2021/12/19 12:23:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ras.c,v 1.5 2021/12/19 12:31:45 riastradh Exp $");
 
 #include <linux/debugfs.h>
 #include <linux/list.h>
@@ -1688,6 +1688,7 @@
        kfree((*data)->bps_bo);
        kfree(*data);
        con->eh_data = NULL;
+       mutex_destroy(&con->recovery_lock);
 out:
        DRM_WARN("Failed to initialize ras recovery!\n");
 
@@ -1706,12 +1707,11 @@
        cancel_work_sync(&con->recovery_work);
        amdgpu_ras_release_bad_pages(adev);
 
-       mutex_lock(&con->recovery_lock);
+       mutex_destroy(&con->recovery_lock);
        con->eh_data = NULL;
        kfree(data->bps);
        kfree(data->bps_bo);
        kfree(data);
-       mutex_unlock(&con->recovery_lock);
 
        return 0;
 }
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ras_eeprom.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ras_eeprom.c     Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ras_eeprom.c     Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_ras_eeprom.c,v 1.3 2021/12/19 12:21:29 riastradh Exp $  */
+/*     $NetBSD: amdgpu_ras_eeprom.c,v 1.4 2021/12/19 12:31:45 riastradh Exp $  */
 
 /*
  * Copyright 2019 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ras_eeprom.c,v 1.3 2021/12/19 12:21:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ras_eeprom.c,v 1.4 2021/12/19 12:31:45 riastradh Exp $");
 
 #include "amdgpu_ras_eeprom.h"
 #include "amdgpu.h"
@@ -285,6 +285,8 @@
        default:
                return;
        }
+
+       mutex_destroy(&control->tbl_mutex);
 }
 
 static void __encode_table_record_to_buff(struct amdgpu_ras_eeprom_control *control,
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ring.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ring.c   Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ring.c   Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_ring.c,v 1.6 2021/12/19 12:21:29 riastradh Exp $        */
+/*     $NetBSD: amdgpu_ring.c,v 1.7 2021/12/19 12:31:45 riastradh Exp $        */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
  *          Christian König
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ring.c,v 1.6 2021/12/19 12:21:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ring.c,v 1.7 2021/12/19 12:31:45 riastradh Exp $");
 
 #include <linux/seq_file.h>
 #include <linux/slab.h>
@@ -381,6 +381,8 @@
        ring->me = 0;
 
        ring->adev->rings[ring->idx] = NULL;
+
+       mutex_destroy(&ring->priority_mutex);
 }
 
 /**
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c    Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c    Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_ttm.c,v 1.9 2021/12/19 12:21:29 riastradh Exp $ */
+/*     $NetBSD: amdgpu_ttm.c,v 1.10 2021/12/19 12:31:45 riastradh Exp $        */
 
 /*
  * Copyright 2009 Jerome Glisse.
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ttm.c,v 1.9 2021/12/19 12:21:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ttm.c,v 1.10 2021/12/19 12:31:45 riastradh Exp $");
 
 #include <linux/dma-mapping.h>
 #include <linux/iommu.h>
@@ -2069,6 +2069,7 @@
        ttm_bo_clean_mm(&adev->mman.bdev, AMDGPU_PL_OA);
        ttm_bo_device_release(&adev->mman.bdev);
        adev->mman.initialized = false;
+       mutex_destroy(&adev->mman.gtt_window_lock);
        DRM_INFO("amdgpu: ttm finalized\n");
 }
 
diff -r 34e06b3ab4ac -r 492f985b11fd sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c     Sun Dec 19 12:31:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c     Sun Dec 19 12:31:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_vm.c,v 1.9 2021/12/19 12:31:04 riastradh Exp $  */
+/*     $NetBSD: amdgpu_vm.c,v 1.10 2021/12/19 12:31:45 riastradh Exp $ */
 



Home | Main Index | Thread Index | Old Index