drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3
authorLang Yu <Lang.Yu@amd.com>
Tue, 22 Jun 2021 16:23:34 +0000 (12:23 -0400)
committerAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Wed, 23 Jun 2021 18:59:39 +0000 (14:59 -0400)
Sometimes drivers need to use bounce buffers to evict BOs. While those reside
in some domain they are not necessarily suitable for CS.

Add a flag so that drivers can note that a bounce buffers needs to be
reallocated during validation.

v2: add detailed comments
v3 (chk): merge commits and rework commit message

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210622162339.761651-1-andrey.grodzovsky@amd.com
drivers/gpu/drm/ttm/ttm_bo.c
include/drm/ttm/ttm_placement.h

index 6c78149360c42a058c36d39b36fd9f9cfc07d7bf..5a2dc712c632d2d89cb4733d20e84e636bb80082 100644 (file)
@@ -918,6 +918,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places,
 {
        unsigned i;
 
+       if (mem->placement & TTM_PL_FLAG_TEMPORARY)
+               return false;
+
        for (i = 0; i < num_placement; i++) {
                const struct ttm_place *heap = &places[i];
 
index aa6ba4d0cf78412877c37acbded36539a471b1aa..8995c9e4ec1b27d57a5d268768bbe2e2cb426eb4 100644 (file)
  * top of the memory area, instead of the bottom.
  */
 
-#define TTM_PL_FLAG_CONTIGUOUS  (1 << 19)
-#define TTM_PL_FLAG_TOPDOWN     (1 << 22)
+#define TTM_PL_FLAG_CONTIGUOUS  (1 << 0)
+#define TTM_PL_FLAG_TOPDOWN     (1 << 1)
+
+/* For multihop handling */
+#define TTM_PL_FLAG_TEMPORARY   (1 << 2)
 
 /**
  * struct ttm_place