Compare
bd22f7e63509fa758cf500d9af3e88a3d3df96be..5b0a459f990be2faba33229fd93f10f23745fab2
drm/amdgpu: destroy mutex when tearing down ttm buffer entity
Pair mutex_init() with mutex_destroy() on the GART window allocation failure path and in amdgpu_ttm_buffer_entity_fini(). This is a no-op without CONFIG_DEBUG_MUTEXES, but it keeps lockdep from seeing a live mutex after the entity is freed or re-initialized. Signed-off-by: Perry Yuan <perry.yuan@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 03ac40aeed034a0a0d5824ad26f8fbe1f6463698) Cc: stable@vger.kernel.org
Perry Yuan <perry.yuan@amd.com> · 2026-09-10 08:58 UTC · committed by Alex Deucher
5 files changed,
+11
−18
- drivers/gpio/gpio-nct6694.c
- drivers/gpio/gpiolib-shared.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
- drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
- tools/gpio/Makefile
modified drivers/gpio/gpio-nct6694.c
| @@ -444,7 +444,7 @@ static int nct6694_gpio_probe(struct platform_device *pdev) | |||
| 444 | 444 | data->gpio.set_config = nct6694_set_config; | |
| 445 | 445 | data->gpio.init_valid_mask = nct6694_init_valid_mask; | |
| 446 | 446 | data->gpio.base = -1; | |
| 447 | - | data->gpio.can_sleep = true; | |
| 447 | + | data->gpio.can_sleep = false; | |
| 448 | 448 | data->gpio.owner = THIS_MODULE; | |
| 449 | 449 | data->gpio.ngpio = NCT6694_NR_GPIO; | |
| 450 | 450 | ||
modified drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
| @@ -2065,14 +2065,15 @@ static int amdgpu_ttm_buffer_entity_init(struct amdgpu_gtt_mgr *mgr, | |||
| 2065 | 2065 | int i, r, num_pages; | |
| 2066 | 2066 | const u64 GTT_MAX_PAGES = (AMDGPU_GTT_MAX_TRANSFER_SIZE >> PAGE_SHIFT); | |
| 2067 | 2067 | ||
| 2068 | + | if (ARRAY_SIZE(entity->gart_window_offs) < num_gart_windows) | |
| 2069 | + | return -EINVAL; | |
| 2070 | + | ||
| 2068 | 2071 | r = drm_sched_entity_init(&entity->base, prio, scheds, num_schedulers, NULL); | |
| 2069 | 2072 | if (r) | |
| 2070 | 2073 | return r; | |
| 2071 | 2074 | ||
| 2072 | 2075 | mutex_init(&entity->lock); | |
| 2073 | 2076 | ||
| 2074 | - | if (ARRAY_SIZE(entity->gart_window_offs) < num_gart_windows) | |
| 2075 | - | return -EINVAL; | |
| 2076 | 2077 | if (num_gart_windows == 0) | |
| 2077 | 2078 | return 0; | |
| 2078 | 2079 | ||
| @@ -2080,6 +2081,7 @@ static int amdgpu_ttm_buffer_entity_init(struct amdgpu_gtt_mgr *mgr, | |||
| 2080 | 2081 | r = amdgpu_gtt_mgr_alloc_entries(mgr, &entity->gart_node, num_pages, | |
| 2081 | 2082 | DRM_MM_INSERT_BEST); | |
| 2082 | 2083 | if (r) { | |
| 2084 | + | mutex_destroy(&entity->lock); | |
| 2083 | 2085 | drm_sched_entity_destroy(&entity->base); | |
| 2084 | 2086 | return r; | |
| 2085 | 2087 | } | |
| @@ -2097,6 +2099,7 @@ static void amdgpu_ttm_buffer_entity_fini(struct amdgpu_gtt_mgr *mgr, | |||
| 2097 | 2099 | struct amdgpu_ttm_buffer_entity *entity) | |
| 2098 | 2100 | { | |
| 2099 | 2101 | amdgpu_gtt_mgr_free_entries(mgr, &entity->gart_node); | |
| 2102 | + | mutex_destroy(&entity->lock); | |
| 2100 | 2103 | drm_sched_entity_destroy(&entity->base); | |
| 2101 | 2104 | } | |
| 2102 | 2105 | ||
modified drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
| @@ -288,7 +288,7 @@ static int uvd_v3_1_fw_validate(struct amdgpu_device *adev) | |||
| 288 | 288 | int i; | |
| 289 | 289 | uint32_t keysel = adev->uvd.keyselect; | |
| 290 | 290 | ||
| 291 | - | if (RREG32(mmUVD_FW_START) & UVD_FW_STATUS__PASS_MASK) { | |
| 291 | + | if (RREG32(mmUVD_FW_START)) { | |
| 292 | 292 | dev_dbg(adev->dev, "UVD keyselect already set: 0x%x (on CPU: 0x%x)\n", | |
| 293 | 293 | RREG32(mmUVD_FW_START), adev->uvd.keyselect); | |
| 294 | 294 | return 0; | |
modified tools/gpio/Makefile
| @@ -7,13 +7,7 @@ bindir ?= /usr/bin | |||
| 7 | 7 | # isn't set and when invoked from selftests build, where srctree | |
| 8 | 8 | # is set to ".". building_out_of_srctree is undefined for in srctree | |
| 9 | 9 | # builds | |
| 10 | - | ifeq ($(srctree),) | |
| 11 | - | update_srctree := 1 | |
| 12 | - | endif | |
| 13 | 10 | ifndef building_out_of_srctree | |
| 14 | - | update_srctree := 1 | |
| 15 | - | endif | |
| 16 | - | ifeq ($(update_srctree),1) | |
| 17 | 11 | srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 18 | 12 | srctree := $(patsubst %/,%,$(dir $(srctree))) | |
| 19 | 13 | endif | |