+++ /dev/null
-From 446e7eb59c66c034599fde1946932a5f6393a89e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 19 Dec 2023 17:10:34 +0800
-Subject: drm/amdgpu/gfx11: need acquire mutex before access CP_VMID_RESET v2
-
-From: Jack Xiao <Jack.Xiao@amd.com>
-
-[ Upstream commit 4b5c5f5ad38b9435518730cc7f8f1e8de9c5cb2f ]
-
-It's required to take the gfx mutex before access to CP_VMID_RESET,
-for there is a race condition with CP firmware to write the register.
-
-v2: add extra code to ensure the mutex releasing is successful.
-
-Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
-Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
-Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 48 +++++++++++++++++++++++++-
- 1 file changed, 47 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
-index 1f9f7fdd4b8e0..85598c08897a0 100644
---- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
-+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
-@@ -4521,11 +4521,43 @@ static int gfx_v11_0_wait_for_idle(void *handle)
- return -ETIMEDOUT;
- }
-
-+static int gfx_v11_0_request_gfx_index_mutex(struct amdgpu_device *adev,
-+ int req)
-+{
-+ u32 i, tmp, val;
-+
-+ for (i = 0; i < adev->usec_timeout; i++) {
-+ /* Request with MeId=2, PipeId=0 */
-+ tmp = REG_SET_FIELD(0, CP_GFX_INDEX_MUTEX, REQUEST, req);
-+ tmp = REG_SET_FIELD(tmp, CP_GFX_INDEX_MUTEX, CLIENTID, 4);
-+ WREG32_SOC15(GC, 0, regCP_GFX_INDEX_MUTEX, tmp);
-+
-+ val = RREG32_SOC15(GC, 0, regCP_GFX_INDEX_MUTEX);
-+ if (req) {
-+ if (val == tmp)
-+ break;
-+ } else {
-+ tmp = REG_SET_FIELD(tmp, CP_GFX_INDEX_MUTEX,
-+ REQUEST, 1);
-+
-+ /* unlocked or locked by firmware */
-+ if (val != tmp)
-+ break;
-+ }
-+ udelay(1);
-+ }
-+
-+ if (i >= adev->usec_timeout)
-+ return -EINVAL;
-+
-+ return 0;
-+}
-+
- static int gfx_v11_0_soft_reset(void *handle)
- {
- u32 grbm_soft_reset = 0;
- u32 tmp;
-- int i, j, k;
-+ int r, i, j, k;
- struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
- tmp = RREG32_SOC15(GC, 0, regCP_INT_CNTL);
-@@ -4565,6 +4597,13 @@ static int gfx_v11_0_soft_reset(void *handle)
- }
- }
-
-+ /* Try to acquire the gfx mutex before access to CP_VMID_RESET */
-+ r = gfx_v11_0_request_gfx_index_mutex(adev, 1);
-+ if (r) {
-+ DRM_ERROR("Failed to acquire the gfx mutex during soft reset\n");
-+ return r;
-+ }
-+
- WREG32_SOC15(GC, 0, regCP_VMID_RESET, 0xfffffffe);
-
- // Read CP_VMID_RESET register three times.
-@@ -4573,6 +4612,13 @@ static int gfx_v11_0_soft_reset(void *handle)
- RREG32_SOC15(GC, 0, regCP_VMID_RESET);
- RREG32_SOC15(GC, 0, regCP_VMID_RESET);
-
-+ /* release the gfx mutex */
-+ r = gfx_v11_0_request_gfx_index_mutex(adev, 0);
-+ if (r) {
-+ DRM_ERROR("Failed to release the gfx mutex during soft reset\n");
-+ return r;
-+ }
-+
- for (i = 0; i < adev->usec_timeout; i++) {
- if (!RREG32_SOC15(GC, 0, regCP_HQD_ACTIVE) &&
- !RREG32_SOC15(GC, 0, regCP_GFX_HQD_ACTIVE))
---
-2.43.0
-
drm-rockchip-vop2-clear-afbc-en-and-transform-bit-fo.patch
bluetooth-hci_conn-check-non-null-function-before-ca.patch
gfs2-refcounting-fix-in-gfs2_thaw_super.patch
-drm-amdgpu-gfx11-need-acquire-mutex-before-access-cp.patch
nvmet-trace-avoid-dereferencing-pointer-too-early.patch
ext4-do-not-trim-the-group-with-corrupted-block-bitm.patch
afs-fix-__afs_break_callback-afs_drop_open_mmap-race.patch
+++ /dev/null
-From 72516630230bee2668c491fdafcac27c565a5ad5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 19 Dec 2023 17:10:34 +0800
-Subject: drm/amdgpu/gfx11: need acquire mutex before access CP_VMID_RESET v2
-
-From: Jack Xiao <Jack.Xiao@amd.com>
-
-[ Upstream commit 4b5c5f5ad38b9435518730cc7f8f1e8de9c5cb2f ]
-
-It's required to take the gfx mutex before access to CP_VMID_RESET,
-for there is a race condition with CP firmware to write the register.
-
-v2: add extra code to ensure the mutex releasing is successful.
-
-Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
-Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
-Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 48 +++++++++++++++++++++++++-
- 1 file changed, 47 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
-index c81e98f0d17ff..17a09e96b30fc 100644
---- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
-+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
-@@ -4430,11 +4430,43 @@ static int gfx_v11_0_wait_for_idle(void *handle)
- return -ETIMEDOUT;
- }
-
-+static int gfx_v11_0_request_gfx_index_mutex(struct amdgpu_device *adev,
-+ int req)
-+{
-+ u32 i, tmp, val;
-+
-+ for (i = 0; i < adev->usec_timeout; i++) {
-+ /* Request with MeId=2, PipeId=0 */
-+ tmp = REG_SET_FIELD(0, CP_GFX_INDEX_MUTEX, REQUEST, req);
-+ tmp = REG_SET_FIELD(tmp, CP_GFX_INDEX_MUTEX, CLIENTID, 4);
-+ WREG32_SOC15(GC, 0, regCP_GFX_INDEX_MUTEX, tmp);
-+
-+ val = RREG32_SOC15(GC, 0, regCP_GFX_INDEX_MUTEX);
-+ if (req) {
-+ if (val == tmp)
-+ break;
-+ } else {
-+ tmp = REG_SET_FIELD(tmp, CP_GFX_INDEX_MUTEX,
-+ REQUEST, 1);
-+
-+ /* unlocked or locked by firmware */
-+ if (val != tmp)
-+ break;
-+ }
-+ udelay(1);
-+ }
-+
-+ if (i >= adev->usec_timeout)
-+ return -EINVAL;
-+
-+ return 0;
-+}
-+
- static int gfx_v11_0_soft_reset(void *handle)
- {
- u32 grbm_soft_reset = 0;
- u32 tmp;
-- int i, j, k;
-+ int r, i, j, k;
- struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
- tmp = RREG32_SOC15(GC, 0, regCP_INT_CNTL);
-@@ -4474,6 +4506,13 @@ static int gfx_v11_0_soft_reset(void *handle)
- }
- }
-
-+ /* Try to acquire the gfx mutex before access to CP_VMID_RESET */
-+ r = gfx_v11_0_request_gfx_index_mutex(adev, 1);
-+ if (r) {
-+ DRM_ERROR("Failed to acquire the gfx mutex during soft reset\n");
-+ return r;
-+ }
-+
- WREG32_SOC15(GC, 0, regCP_VMID_RESET, 0xfffffffe);
-
- // Read CP_VMID_RESET register three times.
-@@ -4482,6 +4521,13 @@ static int gfx_v11_0_soft_reset(void *handle)
- RREG32_SOC15(GC, 0, regCP_VMID_RESET);
- RREG32_SOC15(GC, 0, regCP_VMID_RESET);
-
-+ /* release the gfx mutex */
-+ r = gfx_v11_0_request_gfx_index_mutex(adev, 0);
-+ if (r) {
-+ DRM_ERROR("Failed to release the gfx mutex during soft reset\n");
-+ return r;
-+ }
-+
- for (i = 0; i < adev->usec_timeout; i++) {
- if (!RREG32_SOC15(GC, 0, regCP_HQD_ACTIVE) &&
- !RREG32_SOC15(GC, 0, regCP_GFX_HQD_ACTIVE))
---
-2.43.0
-
bluetooth-hci_conn-check-non-null-function-before-ca.patch
gfs2-refcounting-fix-in-gfs2_thaw_super.patch
edac-skx_common-filter-out-the-invalid-address.patch
-drm-amdgpu-gfx11-need-acquire-mutex-before-access-cp.patch
nvmet-trace-avoid-dereferencing-pointer-too-early.patch
ext4-do-not-trim-the-group-with-corrupted-block-bitm.patch
btrfs-zlib-fix-and-simplify-the-inline-extent-decomp.patch