From patchwork Wed Jan 25 15:50:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 13115826 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA545C54E94 for ; Wed, 25 Jan 2023 15:50:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6999C10E7EC; Wed, 25 Jan 2023 15:50:29 +0000 (UTC) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5EC3210E064; Wed, 25 Jan 2023 15:50:27 +0000 (UTC) Received: by mail-ej1-x629.google.com with SMTP id hw16so48727537ejc.10; Wed, 25 Jan 2023 07:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=d6nKsVQWYuLQ6aCS/WYm2KJtsO8lgj3Z2DbwICUXzAQ=; b=l+QSGaXY36Ke8A5CTfNbc3JmU3FDNzQ+hfoVXhrUjQld/5IagI4RvaurA3K/svdTF8 Wgb3HIOzKqPHtD6KX3wtj53FYQMA9B3EFfuW8AsBzUeRh7e9vOw/s+QKKl+j+umf17Ck NiOkTFJ73dfufxU8R/0yPfUjx2rpR4HuGMThYgUf+xMrs6/j2Rt0XdleajQDqAzEu+NU rT7lWbDnKN73v+mfvpsPs8Or6emzo2zBRBanzU/UApBUKGOGuFqwhxqE6tBO+gYe2oWz QtqLRPDVBRV0MU0EMfQeO/fAyWueonBhBc5nG3WN7DimLMhsym9lobA8chSQLnSS/G0e me3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=d6nKsVQWYuLQ6aCS/WYm2KJtsO8lgj3Z2DbwICUXzAQ=; b=lyzi9PZNDlGBLWf3KVUfty1W9N7AwfEPxKWh2ZD35RNhN0k2BTeJvKM5RZ4lxQUPzy xYKDNfKKflotEXpwT6p1BnJ0QL3LMuPx1bBMCS0R0PqFKMN62zALKofsIZ6qr4HkeIeQ wNncKo2O28mgdzm+iaJZH/9vDtIDhy0pTjvxi2eigC72K6xW360vBZanq/qzvwk8L5sP MtwIVSP5LX5WZALMqfJ8ihKUe+4AoxSP+7zE/88nyJQ+1UJDWsp14VfJtmEC6SFk2Bqs YOuIQqGTt3ZuO3PUU9IWOFMuBzXitg0AC0S9VX/vO8bBZ/klSqodZAL36XkBD0uWgXR+ o4Yw== X-Gm-Message-State: AFqh2kon5C4lxUKIXVcxkov3ndwqcukSxomyYK0a2qdpbEsSg6AI0pUa yQq/APGFd42YDxcYLhlx+CM= X-Google-Smtp-Source: AMrXdXtlODrQbdt0785ntG+nwaNXkZw0lRt3fbEEssLxQjLRlw/uoFyrjYf5sScTYeyHDWIET90z+w== X-Received: by 2002:a17:906:9f1c:b0:870:3c70:8c8d with SMTP id fy28-20020a1709069f1c00b008703c708c8dmr29109510ejc.17.1674661825746; Wed, 25 Jan 2023 07:50:25 -0800 (PST) Received: from EliteBook.fritz.box ([2a02:908:1256:79a0:180c:8737:8e57:6be7]) by smtp.gmail.com with ESMTPSA id a7-20020a1709063e8700b007ad69e9d34dsm2561609ejj.54.2023.01.25.07.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 07:50:25 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.william.auld@gmail.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Wed, 25 Jan 2023 16:50:22 +0100 Message-Id: <20230125155023.105584-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/2] drm/ttm: revert "stop allocating a dummy resource for pipelined gutting" X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This reverts commit 4110872b8115aab2adb3a52149c144d8465440de. This still seems to break i915. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo_util.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 17330fb4480a..fca8b0e0e30a 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -704,23 +704,30 @@ EXPORT_SYMBOL(ttm_bo_move_sync_cleanup); */ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo) { + static const struct ttm_place sys_mem = { .mem_type = TTM_PL_SYSTEM }; struct ttm_buffer_object *ghost; + struct ttm_resource *sys_res; struct ttm_tt *ttm; int ret; + ret = ttm_resource_alloc(bo, &sys_mem, &sys_res); + if (ret) + return ret; + /* If already idle, no need for ghost object dance. */ if (dma_resv_test_signaled(bo->base.resv, DMA_RESV_USAGE_BOOKKEEP)) { if (!bo->ttm) { /* See comment below about clearing. */ ret = ttm_tt_create(bo, true); if (ret) - return ret; + goto error_free_sys_mem; } else { ttm_tt_unpopulate(bo->bdev, bo->ttm); if (bo->type == ttm_bo_type_device) ttm_tt_mark_for_clear(bo->ttm); } ttm_resource_free(bo, &bo->resource); + ttm_bo_assign_mem(bo, sys_res); return 0; } @@ -737,7 +744,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo) ret = ttm_tt_create(bo, true); swap(bo->ttm, ttm); if (ret) - return ret; + goto error_free_sys_mem; ret = ttm_buffer_object_transfer(bo, &ghost); if (ret) @@ -753,9 +760,13 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo) dma_resv_unlock(&ghost->base._resv); ttm_bo_put(ghost); bo->ttm = ttm; + ttm_bo_assign_mem(bo, sys_res); return 0; error_destroy_tt: ttm_tt_destroy(bo->bdev, ttm); + +error_free_sys_mem: + ttm_resource_free(bo, &sys_res); return ret; } From patchwork Wed Jan 25 15:50:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 13115827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52227C54E94 for ; Wed, 25 Jan 2023 15:50:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C783110E7F1; Wed, 25 Jan 2023 15:50:30 +0000 (UTC) Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A66310E064; Wed, 25 Jan 2023 15:50:28 +0000 (UTC) Received: by mail-ej1-x632.google.com with SMTP id vw16so48775276ejc.12; Wed, 25 Jan 2023 07:50:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=A7s+zcG+Jvy1ETp3kyJm5MZOt4i9aTMhK4xPQgp1cXI=; b=IMi13qDJQYX+K/HYIQOfVan0JHLHVX3nEaH6+C/flxc62qy1EcExuVzaJXDKeKGrMf SBiwtVBPiSX4oIF1iPfmNebnzcDSX8TTgzpl98gZ8LN0DH0alubaa+pvWFdZX+zK0Inv or+oRPtG2ymdW5mYmFxwYeh1Jy0RwZjC2AZTPWlgmjbWahjuYu/dwsSx4uAac7B/fDVk yblLgeEaIKDKvaJPFbqoqIYV0rcMPrFuZ8oWJlCf0g+ryhX0rCRE+bqxBtpXTzsJOFA2 aJxqpAc/sD4BJeb3HNJ9SDUX+g7s/2BT4+NKXpT/EjZKuNdEXL89ag9LPFtmvDIHx+Wq P+mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A7s+zcG+Jvy1ETp3kyJm5MZOt4i9aTMhK4xPQgp1cXI=; b=i18JdPx6S4UB/pEuarYMx2twRFjCn89o322T11myNqgzu16yL1R8U1lli3h7G0C3NK Ql3P0hD7rvZQ4tSTgZA2l1qnCbddmhy791+KFpSBGwu4HVcWkOlo3JI2BB+DcBrv35tQ IoKKYKd0QiSeQUqHxzPqXr0VKa9spiQJ/4bidhcNjN6xoFQdIq8i/weP9mKe3XJGAFpa Z7xa/rURkM/YIa7OxKpDPn+CICBj42GtwJfhNcoXOZj8yMtGeUIWCmoHV/JyhS0ChyQ3 fxSDvompOu8LpsWKmwhsc834lYk8npIMul/VTOxb8i4jNlbGQ8UoB+EyYzj2n9b0uy4q QHQQ== X-Gm-Message-State: AFqh2kr1Qqtwgcy9e1r9LzRiqlOvH3PKZeqNOT9JP9JFlkoiYQQlUdGv ghVBEf4WE0DhmxYG9mgxo0g= X-Google-Smtp-Source: AMrXdXsZcw9cBL/ZwUP6Up4MwLIs/bpfB7mUdMZqzLbV0aL/Tihn1huhpOcz62YjR9drfz2i3TwEsA== X-Received: by 2002:a17:907:629c:b0:86e:9345:e701 with SMTP id nd28-20020a170907629c00b0086e9345e701mr44140029ejc.2.1674661826590; Wed, 25 Jan 2023 07:50:26 -0800 (PST) Received: from EliteBook.fritz.box ([2a02:908:1256:79a0:180c:8737:8e57:6be7]) by smtp.gmail.com with ESMTPSA id a7-20020a1709063e8700b007ad69e9d34dsm2561609ejj.54.2023.01.25.07.50.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 07:50:26 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.william.auld@gmail.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Wed, 25 Jan 2023 16:50:23 +0100 Message-Id: <20230125155023.105584-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230125155023.105584-1-christian.koenig@amd.com> References: <20230125155023.105584-1-christian.koenig@amd.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/2] drm/ttm: revert "stop allocating dummy resources during BO creation" X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This reverts commit 00984ad39599bb2a1e6ec5d4e9c75a749f7f45c9. It seems to still breka i915. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 33471e363ff4..9baccb2f6e99 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -957,6 +957,7 @@ int ttm_bo_init_reserved(struct ttm_device *bdev, struct ttm_buffer_object *bo, struct sg_table *sg, struct dma_resv *resv, void (*destroy) (struct ttm_buffer_object *)) { + static const struct ttm_place sys_mem = { .mem_type = TTM_PL_SYSTEM }; int ret; kref_init(&bo->kref); @@ -973,6 +974,12 @@ int ttm_bo_init_reserved(struct ttm_device *bdev, struct ttm_buffer_object *bo, bo->base.resv = &bo->base._resv; atomic_inc(&ttm_glob.bo_count); + ret = ttm_resource_alloc(bo, &sys_mem, &bo->resource); + if (unlikely(ret)) { + ttm_bo_put(bo); + return ret; + } + /* * For ttm_bo_type_device buffers, allocate * address space from the device.