amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/15] drm/amdgpu: Add interface to reserve bad page
@ 2024-04-18  2:58 YiPeng Chai
  2024-04-18  2:58 ` [PATCH 02/15] drm/amdgpu: add message fifo to handle RAS poison events YiPeng Chai
                   ` (14 more replies)
  0 siblings, 15 replies; 29+ messages in thread
From: YiPeng Chai @ 2024-04-18  2:58 UTC (permalink / raw)
  To: amd-gfx
  Cc: yipechai, Hawking.Zhang, Tao.Zhou1, Candice.Li, KevinYang.Wang,
	Stanley.Yang, YiPeng Chai

Add interface to reserve bad page.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 19 +++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h |  4 ++++
 2 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 2c97cb80d79a..05782d68f073 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -2782,6 +2782,7 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev)
 		}
 	}
 
+	mutex_init(&con->page_rsv_lock);
 	mutex_init(&con->page_retirement_lock);
 	init_waitqueue_head(&con->page_retirement_wq);
 	atomic_set(&con->page_retirement_req_cnt, 0);
@@ -2835,6 +2836,8 @@ static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)
 
 	atomic_set(&con->page_retirement_req_cnt, 0);
 
+	mutex_destroy(&con->page_rsv_lock);
+
 	cancel_work_sync(&con->recovery_work);
 
 	mutex_lock(&con->recovery_lock);
@@ -4278,3 +4281,19 @@ void amdgpu_ras_query_boot_status(struct amdgpu_device *adev, u32 num_instances)
 			amdgpu_ras_boot_time_error_reporting(adev, i, boot_error);
 	}
 }
+
+int amdgpu_ras_reserve_page(struct amdgpu_device *adev, uint64_t pfn)
+{
+	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+	struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr;
+	uint64_t start = pfn << AMDGPU_GPU_PAGE_SHIFT;
+	int ret = 0;
+
+	mutex_lock(&con->page_rsv_lock);
+	ret = amdgpu_vram_mgr_query_page_status(mgr, start);
+	if (ret == -ENOENT)
+		ret = amdgpu_vram_mgr_reserve_range(mgr, start, AMDGPU_GPU_PAGE_SIZE);
+	mutex_unlock(&con->page_rsv_lock);
+
+	return ret;
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
index 8d26989c75c8..ab5bf573378e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
@@ -500,6 +500,7 @@ struct amdgpu_ras {
 	wait_queue_head_t page_retirement_wq;
 	struct mutex page_retirement_lock;
 	atomic_t page_retirement_req_cnt;
+	struct mutex page_rsv_lock;
 	/* Fatal error detected flag */
 	atomic_t fed;
 
@@ -909,4 +910,7 @@ bool amdgpu_ras_get_fed_status(struct amdgpu_device *adev);
 
 bool amdgpu_ras_event_id_is_valid(struct amdgpu_device *adev, u64 id);
 u64 amdgpu_ras_acquire_event_id(struct amdgpu_device *adev, enum ras_event_type type);
+
+int amdgpu_ras_reserve_page(struct amdgpu_device *adev, uint64_t pfn);
+
 #endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2024-04-25  3:35 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18  2:58 [PATCH 01/15] drm/amdgpu: Add interface to reserve bad page YiPeng Chai
2024-04-18  2:58 ` [PATCH 02/15] drm/amdgpu: add message fifo to handle RAS poison events YiPeng Chai
2024-04-18  2:58 ` [PATCH 03/15] drm/amdgpu: prepare for logging ecc errors YiPeng Chai
2024-04-18  2:58 ` [PATCH 04/15] drm/amdgpu: add poison creation handler YiPeng Chai
2024-04-25  2:32   ` Zhang, Hawking
2024-04-25  3:35     ` Chai, Thomas
2024-04-18  2:58 ` [PATCH 05/15] drm/amdgpu: add interface to update umc v12_0 ecc status YiPeng Chai
2024-04-18  2:58 ` [PATCH 06/15] drm/amdgpu: umc v12_0 converts error address YiPeng Chai
2024-04-25  3:02   ` Zhang, Hawking
2024-04-25  3:31     ` Chai, Thomas
2024-04-18  2:58 ` [PATCH 07/15] drm/amdgpu: umc v12_0 logs ecc errors YiPeng Chai
2024-04-18  2:58 ` [PATCH 08/15] drm/amdgpu: Add delay work to retire bad pages YiPeng Chai
2024-04-18  2:58 ` [PATCH 09/15] drm/amdgpu: add condition check for amdgpu_umc_fill_error_record YiPeng Chai
2024-04-18  2:58 ` [PATCH 10/15] drm/amdgpu: retire bad pages for umc v12_0 YiPeng Chai
2024-04-22  8:14   ` Zhou1, Tao
2024-04-22  9:21     ` Chai, Thomas
2024-04-22  9:33       ` Chai, Thomas
2024-04-18  2:58 ` [PATCH 11/15] drm/amdgpu: prepare to handle pasid poison consumption YiPeng Chai
2024-04-25  3:00   ` Zhang, Hawking
2024-04-25  3:17     ` Chai, Thomas
2024-04-18  2:58 ` [PATCH 12/15] drm/amdgpu: add poison consumption handler YiPeng Chai
2024-04-18  2:58 ` [PATCH 13/15] drm/amdgpu: support ACA logging ecc errors YiPeng Chai
2024-04-18  2:58 ` [PATCH 14/15] drm/amdgpu: Fix address translation defect YiPeng Chai
2024-04-18  2:58 ` [PATCH 15/15] drm/amdgpu: Use new interface to reserve bad page YiPeng Chai
2024-04-18  9:00   ` Christian König
2024-04-18  9:34     ` Chai, Thomas
2024-04-22  8:27       ` Zhou1, Tao
2024-04-22  2:25   ` Chai, Thomas
2024-04-22  7:06 ` [PATCH 01/15] drm/amdgpu: Add " Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).