On 10.04.2024 16:24, Matthew Auld wrote:
On 22/03/2024 14:29, Karolina Stolarek wrote:
+static const struct ttm_bo_validate_test_case ttm_mem_type_cases[] = {
+ {
+ .description = "System manager",
+ .mem_type = TTM_PL_SYSTEM,
+ },
+ {
+ .description = "VRAM manager",
+ .mem_type = TTM_PL_SYSTEM,
This should be PL_VRAM ?
Facepalm
Yes, indeed it should be VRAM, well spotted.
(...)
diff --git a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
index c75de24de783..83a942919cc8 100644
--- a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
+++ b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
@@ -27,8 +27,43 @@ static int mock_move(struct ttm_buffer_object *bo,
bool evict,
struct ttm_resource *new_mem,
struct ttm_place *hop)
{
- bo->resource = new_mem;
- return 0;
+ struct ttm_resource *old_mem = bo->resource;
+ int ret;
+
+ if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM && !bo->ttm)) {
+ ttm_bo_move_null(bo, new_mem);
+ return 0;
+ }
+
+ /* Dummy multihop */
+ if (bo->resource->mem_type == TTM_PL_VRAM &&
+ new_mem->mem_type == TTM_PL_MULTIHOP) {
Do we need this dummy multi-hop type? Is not possible to just do this
for SYSTEM -> TT -> VRAM and/or VRAM -> TT -> SYSTEM, that's at least
the normal flow which requires the multi-hop sequence in the middle.
Hmm, back in the day it made sense to me to do it this way, but I agree,
using TT domain here would be a better solution. I'll try to rewrite it
and drop multihop type altogether.
Many thanks,
Karolina