From patchwork Tue Jul 23 12:17:43 2024 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: 13739965 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 5A5EEC3DA70 for ; Tue, 23 Jul 2024 12:18:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5475810E293; Tue, 23 Jul 2024 12:18:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FuZjTmV5"; dkim-atps=neutral Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A72810E293 for ; Tue, 23 Jul 2024 12:17:54 +0000 (UTC) Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3685a5e7d3cso3053851f8f.1 for ; Tue, 23 Jul 2024 05:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721737072; x=1722341872; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9pEfEv/FNkQSZD98AMQYP11HYqkAXHtxjxFBvV4TOK4=; b=FuZjTmV5+RhOCo4wxvhOEHmbL6gB0+nuePIsd2+xjD5b1tQGAle95b5ZickduZquKv BWOtYNuCUTxOvuOk9EsyDLalkbPJBuqmeSFr7HFxjCW6lBAHo7p2ATvSu5I+40JqU3U7 XAU4mKKkx7D6fAWnAakSbVHSiWoowzKBp5C6EpN6jUag1aOkEt1L6NHmyNEf/snWrk70 293DRA/zmtfYKbbK37fN5em0VW/m+C+YdmssAVFrURx+SVhuKUmmPMNmljqGkhA/cyCG cv+aMehgzLcVNAJWCTBomRypTaCYZL1QSnEP/vZX6VQC26ItOHqnFn1lYzQcyRKXAlpv DNkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721737072; x=1722341872; 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=9pEfEv/FNkQSZD98AMQYP11HYqkAXHtxjxFBvV4TOK4=; b=F7/9eHoRRMdyTXmfWVxniRP4n5POc1oUCFiUS/MbvBl7nissCWVm2Sj8sxHmaI9Gdf ASPwiAaalRP3ICKdQu7jxpFkklORqIooBWpYTRBbXEY7Y5pTNzEUuJFgLSd8AogDt+ze eHQReC64NGkApnhDi4wXSjSwK/rFbQCUZDvTg6NLmvUCcWxek5fc8seGBVdx+5FKUuBD eXRptQSqnbxwltxeyhZbR6rWVaFKJnex37+A87w67w5F/oPJczrPJSLjvgAXv9/lzSyS 5rApzKCvljzP+po9u9v4m5ktJC5tpFNrl0wWb29tgGpUvt3WPElPvr1QQbs+Kp2bJ/5q OrkQ== X-Gm-Message-State: AOJu0Yy945PdM+E520ddA5kgT1OfRi9BcNf4Eph6DQ/AFhg+In0pMUsQ bXBUk07e0TsekWcs2i1KtVJ/N0flnV6KhffGpy9ZPS5E3bxZMVD6 X-Google-Smtp-Source: AGHT+IGDnnV7eZ9l9B3BxW5b5H3yajiHQk/Tvp+iwj3EHgpFo82Lhz9LQj+qdIz7ZjiMKKxOqmrcNw== X-Received: by 2002:adf:f4d1:0:b0:367:947a:a491 with SMTP id ffacd0b85a97d-369dec206c2mr1920290f8f.26.1721737072057; Tue, 23 Jul 2024 05:17:52 -0700 (PDT) Received: from able.fritz.box ([2a00:e180:1540:9700:699c:86ac:5633:2a7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427db2a4e3bsm138119595e9.44.2024.07.23.05.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:17:51 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.brost@intel.com, thomas.hellstrom@linux.intel.com Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 1/8] drm/amdgpu: use GEM references instead of TTMs Date: Tue, 23 Jul 2024 14:17:43 +0200 Message-Id: <20240723121750.2086-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of a TTM reference grab a GEM reference whenever necessary. Signed-off-by: Christian König Cc: Alex Deucher Cc: Felix Kuehling Cc: amd-gfx@lists.freedesktop.org Reviewed-by: Daniel Vetter --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 67c234bcf89f..6be3d7cd1c51 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -87,11 +87,11 @@ static const struct vm_operations_struct amdgpu_gem_vm_ops = { static void amdgpu_gem_object_free(struct drm_gem_object *gobj) { - struct amdgpu_bo *robj = gem_to_amdgpu_bo(gobj); + struct amdgpu_bo *aobj = gem_to_amdgpu_bo(gobj); - if (robj) { - amdgpu_hmm_unregister(robj); - amdgpu_bo_unref(&robj); + if (aobj) { + amdgpu_hmm_unregister(aobj); + ttm_bo_put(&aobj->tbo); } } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 8d8c39be6129..6c187e310034 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -853,7 +853,7 @@ struct amdgpu_bo *amdgpu_bo_ref(struct amdgpu_bo *bo) if (bo == NULL) return NULL; - ttm_bo_get(&bo->tbo); + drm_gem_object_get(&bo->tbo.base); return bo; } @@ -865,13 +865,10 @@ struct amdgpu_bo *amdgpu_bo_ref(struct amdgpu_bo *bo) */ void amdgpu_bo_unref(struct amdgpu_bo **bo) { - struct ttm_buffer_object *tbo; - if ((*bo) == NULL) return; - tbo = &((*bo)->tbo); - ttm_bo_put(tbo); + drm_gem_object_get(&(*bo)->tbo.base); *bo = NULL; } From patchwork Tue Jul 23 12:17:44 2024 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: 13739963 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 3853FC3DA63 for ; Tue, 23 Jul 2024 12:18:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D8C410E5A4; Tue, 23 Jul 2024 12:18:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Id4A2ELf"; dkim-atps=neutral Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id EB5E810E598 for ; Tue, 23 Jul 2024 12:17:54 +0000 (UTC) Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-368313809a4so2544265f8f.0 for ; Tue, 23 Jul 2024 05:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721737073; x=1722341873; darn=lists.freedesktop.org; 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=WDrSQxR5dtn/3sQ/p+B1Mxs5j5Xf2+2pD6tH3hlzlME=; b=Id4A2ELf3yeDHe7vhYWdIYZ0lSFeKLRV7MVfMelhA6RlW6cpyBN8drkZOhHVJk5FHO Eu7U0ri72v53kM8/oIvV/x69Y3xLCacDPMfAyyIb/WwH32ikG0b0DkyJtLWEvnHamP29 D6cdQywP4V8FSiyrlqUi5Nr6Z18UbbxAZPwh07QAzu9T41VHgG59XdzgqBOk7QX/muIm k26tttA07yTeCJHm4Yvhu4r6j1BoqkPi8VHkEUxajYOfZkFDRicixN5duC98CArVNfhR dasWm8AlDXNLn1T7Mab+4NlSD6PV0jBLd+90vp48mg3GfMyc+FMyvUazNOEaDW9nhgDK fBXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721737073; x=1722341873; 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=WDrSQxR5dtn/3sQ/p+B1Mxs5j5Xf2+2pD6tH3hlzlME=; b=FKuNd2KJ+kD8flAMIOKp9z4H6h82E+CL2HubAcvVimveICrS73LFGwLdjrvE/XNC6Y rqgYC8l6qWVnkkd6lMULodWh0//S6u2TteeBdfAldltGvVWmaXgX0j1i1vlHJYnUXwW6 ndITdrMLSmrYaDhwoa8oSknFrXehqgfFkLy6FT4IfWwfUIUtiETqX/G/NedgI6mfqubP wkSK/zEFpt4CXm1Y5WR1glkHtfWh04GqyE4XmUuI7uV8EO3/tCwwAUzZxunBnn3HBwH3 5wtATpVXsScLB7yme4p6XZ/U/3OI/vRTV3yA7ecuHIemXAJiuIN4nEfDTG5IbqZBbxfQ Zhsw== X-Gm-Message-State: AOJu0YwuEeBV3rt5wRar/Dah2na23VPqc2idfDXHYYAa6AoT9sMcsgSh tTtU36s6EQaZMT9a2loG8mj0jT6cCZyzgUDA6OsZ7T2KX5UrsCqpK1+9Y+cj X-Google-Smtp-Source: AGHT+IFmC32w+KwKsuTPMuvRHuQPLr++89pXfLWwm21BU23T7trgIb6lIsJG4RvTc00fw4Mf5sQa9g== X-Received: by 2002:adf:f5d1:0:b0:368:3ee9:e119 with SMTP id ffacd0b85a97d-369e3f120e2mr1376164f8f.29.1721737072779; Tue, 23 Jul 2024 05:17:52 -0700 (PDT) Received: from able.fritz.box ([2a00:e180:1540:9700:699c:86ac:5633:2a7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427db2a4e3bsm138119595e9.44.2024.07.23.05.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:17:52 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.brost@intel.com, thomas.hellstrom@linux.intel.com Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 2/8] drm/radeon: use GEM references instead of TTMs Date: Tue, 23 Jul 2024 14:17:44 +0200 Message-Id: <20240723121750.2086-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723121750.2086-1-christian.koenig@amd.com> References: <20240723121750.2086-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of a TTM reference grab a GEM reference whenever necessary. Signed-off-by: Christian König Cc: Alex Deucher Cc: amd-gfx@lists.freedesktop.org Reviewed-by: Daniel Vetter --- drivers/gpu/drm/radeon/radeon_gem.c | 2 +- drivers/gpu/drm/radeon/radeon_object.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index 2ef201a072f1..05df49b3a5c6 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c @@ -88,7 +88,7 @@ static void radeon_gem_object_free(struct drm_gem_object *gobj) if (robj) { radeon_mn_unregister(robj); - radeon_bo_unref(&robj); + ttm_bo_put(&robj->tbo); } } diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index a955f8a2f7fe..4b972c8c9516 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -256,18 +256,15 @@ struct radeon_bo *radeon_bo_ref(struct radeon_bo *bo) if (bo == NULL) return NULL; - ttm_bo_get(&bo->tbo); + drm_gem_object_get(&bo->tbo.base); return bo; } void radeon_bo_unref(struct radeon_bo **bo) { - struct ttm_buffer_object *tbo; - if ((*bo) == NULL) return; - tbo = &((*bo)->tbo); - ttm_bo_put(tbo); + drm_gem_object_put(&(*bo)->tbo.base); *bo = NULL; } From patchwork Tue Jul 23 12:17:45 2024 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: 13739966 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 BE0C8C3DA63 for ; Tue, 23 Jul 2024 12:18:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A823110E598; Tue, 23 Jul 2024 12:18:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Wkuwb9Ap"; dkim-atps=neutral Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9034D10E5A1 for ; Tue, 23 Jul 2024 12:17:56 +0000 (UTC) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4266eda81c5so47332735e9.0 for ; Tue, 23 Jul 2024 05:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721737075; x=1722341875; darn=lists.freedesktop.org; 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=DvnOT6MbetEmIuE7eul7M9rz9EK9IOEZ+M4VxPTsMBw=; b=Wkuwb9ApIdqGcxlOibug58MSEAoT/S3Jioe2txjfg2rKvWP84TH/IZwIXZE2TPOoZA qdhoo/H2NvWrrVd5x18mEhwN+4yVpEBQ4rb1IPnzzhQ7lZDAjwGw/KMNV09fD0n/sFgv hCQ7aeMMk3NMB4iEspGHLFFVJ+kqV2mnRK1tfZExAPSrDG+/AOf5C+Psl4G+ufjVErxn 2WqBwWRvmmi9yGCQ/qljTIZFgoBJVv1nZCXNETPN2xcESOyndnXvKo044DdhDykX0dK1 DpWfcK9OlThqmwyTmFuCY1r1Ose/4v/7mhkWOBMkIX9sNZoxHvf7SYoear1G8m0et4Cq f+hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721737075; x=1722341875; 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=DvnOT6MbetEmIuE7eul7M9rz9EK9IOEZ+M4VxPTsMBw=; b=dfCfdILJNGRVbJo4JQL/j91BYNA4KXHwL8X3/SQ6ShSqaYLTSDynXayxpw/v3cvHUR 01KJtGZup066JA/l+uZr8gMguQ4fwEFVCwMIhNr6vZ3z6chaTzm3wWQHsDwvLB80FQud bwheB3wplU2r7jakZo2yTsGuBlrKWJMsv6ScQkTpwZYtMVLCGJiNryb3q+wUtiNl+MNw Qa0hiMxhvkAILfChC7G/aFfj9nTcjmq/pdt+rYinsnJd4hoVn1F3r3oXNjPBiAJ+m3gu M1G3ETWQiqWHNiaibngZI2keY54OdxEhPqEUBQB6OSSI34KhAcIEOQbe1kB02fJNUo1u WmxQ== X-Gm-Message-State: AOJu0Yz8xvdeKMVk9NrnQO5X+LlINOA+RhYmw0ha1RifK1n1MkzBTDLT pjuAW0dm3yBkhN/J7vOAXZjldDQ8u9qfsCawgoUWHL14rOMXqZZu5TC86uTD X-Google-Smtp-Source: AGHT+IHI7S1j4Ce47JE0E/i6QUIeofgi6XWMO4y5wKE/g7oI/kBT0GFD/ET6uFO0+Xs7YffbWpq9Cg== X-Received: by 2002:a05:600c:1d92:b0:426:5e1c:1ac2 with SMTP id 5b1f17b1804b1-427dcf67fe1mr89031155e9.8.1721737073503; Tue, 23 Jul 2024 05:17:53 -0700 (PDT) Received: from able.fritz.box ([2a00:e180:1540:9700:699c:86ac:5633:2a7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427db2a4e3bsm138119595e9.44.2024.07.23.05.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:17:53 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.brost@intel.com, thomas.hellstrom@linux.intel.com Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 3/8] drm/loongson: use GEM references instead of TTMs Date: Tue, 23 Jul 2024 14:17:45 +0200 Message-Id: <20240723121750.2086-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723121750.2086-1-christian.koenig@amd.com> References: <20240723121750.2086-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of a TTM reference grab a GEM reference whenever necessary. Signed-off-by: Christian König Cc: Sui Jingfeng Reviewed-by: Daniel Vetter --- drivers/gpu/drm/loongson/lsdc_ttm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/loongson/lsdc_ttm.c b/drivers/gpu/drm/loongson/lsdc_ttm.c index 465f622ac05d..2e42c6970c9f 100644 --- a/drivers/gpu/drm/loongson/lsdc_ttm.c +++ b/drivers/gpu/drm/loongson/lsdc_ttm.c @@ -341,16 +341,12 @@ void lsdc_bo_unpin(struct lsdc_bo *lbo) void lsdc_bo_ref(struct lsdc_bo *lbo) { - struct ttm_buffer_object *tbo = &lbo->tbo; - - ttm_bo_get(tbo); + drm_gem_object_get(&lbo->tbo.base); } void lsdc_bo_unref(struct lsdc_bo *lbo) { - struct ttm_buffer_object *tbo = &lbo->tbo; - - ttm_bo_put(tbo); + drm_gem_object_put(&lbo->tbo.base); } int lsdc_bo_kmap(struct lsdc_bo *lbo) From patchwork Tue Jul 23 12:17:46 2024 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: 13739967 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 6ABFCC3DA70 for ; Tue, 23 Jul 2024 12:18:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A508B10E5A3; Tue, 23 Jul 2024 12:18:16 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CW50qzpa"; dkim-atps=neutral Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id D824310E5A3 for ; Tue, 23 Jul 2024 12:17:57 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2ef2cce8c08so25867851fa.0 for ; Tue, 23 Jul 2024 05:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721737076; x=1722341876; darn=lists.freedesktop.org; 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=7/nLTjr7fb6DgnhhY7kToe/OCx9NZ3ieJ1ZNo1Hokts=; b=CW50qzpaPKzIOzA6iaNqTtUDgiI6cBwsX2ICacmk8OfdmkV3elVWlv5MPkqJFfE9n1 fuQAz+0QW+/rty6oMc3v18NizDwpnr22Wcd+av1BRBe01WUgD7LufOihzhO6A8C0+YDj lyNOsARyqr7wKT+YbOtf6c+xxv5GzPSElo6hgcb5+Ht+jQDEii3Rv0/t83PBykllCdEw GLYsVUYuma2+fRP1BztHaOgdGVnSg6vAhK46aOjjqOHC0ajSxe7UlovNub7cFky6Z6br T/3q4MSSA1Flynm2pzBDKHQAskr7/9vM49JJADsm4AfX0uNCG776HHY4i4O+Lf7iREPw 5mag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721737076; x=1722341876; 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=7/nLTjr7fb6DgnhhY7kToe/OCx9NZ3ieJ1ZNo1Hokts=; b=ux5r+xk/Y/iR0BZ0nvgN9dWkylwmecUVKHHz1FTJf3TDCRVcCEakg238ggs0xGHx5e ZGUW3PuxqrsVTM8MVHHLmeN6xt4XmddEDPTyPtloP98dr7bArKD8q1oYqHURwHeuqKMo NSAbFEVFhszCZjq4Ma8lLqsDDsdplBTbeaI0U7Wplbj+W8YwWsTP04P9Tf7DxZmY2buN CuBhdZK6unuNWAgLYbngCWtoFkYDfk85sa3iREhsYCl7ZnrKCwzzmQnRjaAIBfbNNaQD WzQKHXtQR+A4TLDDRJLvt74sya9z6lih1j4XiFYQtxvya3sxb+wCk23lL7aswg06LXdJ bUnw== X-Gm-Message-State: AOJu0Yxj+1AcIkeBOG0UgA3asYAWE2do4DnXO5wJMw2iCpGdcO8eoFMV NjJt5WtZ1heQ0buz3JEEQYw30xM+g9BHKSHKZd10aUY9VC3VeSpVJj/udwd3 X-Google-Smtp-Source: AGHT+IFML0EofgGv7Zi1t4YegfpzPHZCkJ8GHouTLQ+ZBQmRhMFDyPlbCvVml4aiT2hiY+W2/uL5GA== X-Received: by 2002:a05:651c:50d:b0:2ef:17ee:62b0 with SMTP id 38308e7fff4ca-2ef17ee6747mr78529431fa.2.1721737075253; Tue, 23 Jul 2024 05:17:55 -0700 (PDT) Received: from able.fritz.box ([2a00:e180:1540:9700:699c:86ac:5633:2a7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427db2a4e3bsm138119595e9.44.2024.07.23.05.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:17:54 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.brost@intel.com, thomas.hellstrom@linux.intel.com Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 4/8] drm/vmwgfx: use GEM references instead of TTMs Date: Tue, 23 Jul 2024 14:17:46 +0200 Message-Id: <20240723121750.2086-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723121750.2086-1-christian.koenig@amd.com> References: <20240723121750.2086-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of a TTM reference grab a GEM reference whenever necessary. Signed-off-by: Christian König Cc: Zack Rusin Cc: Broadcom internal kernel review list --- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_bo.h | 19 ++----------------- drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 16 ++++++++-------- drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 2 +- 9 files changed, 23 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c index 00144632c600..3caaacb124ec 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c @@ -501,7 +501,7 @@ static int vmw_user_bo_synccpu_release(struct drm_file *filp, if (!(flags & drm_vmw_synccpu_allow_cs)) { atomic_dec(&vmw_bo->cpu_writers); } - vmw_user_bo_unref(&vmw_bo); + vmw_bo_unreference(&vmw_bo); } return ret; @@ -543,7 +543,7 @@ int vmw_user_bo_synccpu_ioctl(struct drm_device *dev, void *data, return ret; ret = vmw_user_bo_synccpu_grab(vbo, arg->flags); - vmw_user_bo_unref(&vbo); + vmw_bo_unreference(&vbo); if (unlikely(ret != 0)) { if (ret == -ERESTARTSYS || ret == -EBUSY) return -EBUSY; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h index f349642e6190..42a58d57409d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.h @@ -188,30 +188,15 @@ static inline void vmw_bo_unreference(struct vmw_bo **buf) *buf = NULL; if (tmp_buf) - ttm_bo_put(&tmp_buf->tbo); + drm_gem_object_put(&tmp_buf->tbo.base); } static inline struct vmw_bo *vmw_bo_reference(struct vmw_bo *buf) { - ttm_bo_get(&buf->tbo); + drm_gem_object_get(&buf->tbo.base); return buf; } -static inline struct vmw_bo *vmw_user_bo_ref(struct vmw_bo *vbo) -{ - drm_gem_object_get(&vbo->tbo.base); - return vbo; -} - -static inline void vmw_user_bo_unref(struct vmw_bo **buf) -{ - struct vmw_bo *tmp_buf = *buf; - - *buf = NULL; - if (tmp_buf) - drm_gem_object_put(&tmp_buf->tbo.base); -} - static inline struct vmw_bo *to_vmw_bo(struct drm_gem_object *gobj) { return container_of((gobj), struct vmw_bo, tbo.base); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c index a7c07692262b..6b700ebd71b1 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c @@ -502,7 +502,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) vmw_resource_mob_attach(res); /* Let go of the old mob. */ - vmw_user_bo_unref(&old_buf); + vmw_bo_unreference(&old_buf); res->id = vcotbl->type; ret = dma_resv_reserve_fences(bo->base.resv, 1); @@ -521,7 +521,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) out_wait: ttm_bo_unpin(bo); ttm_bo_unreserve(bo); - vmw_user_bo_unref(&buf); + vmw_bo_unreference(&buf); out_done: MKS_STAT_TIME_POP(MKSSTAT_KERN_COTABLE_RESIZE); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 2e52d73eba48..be29b9ff8901 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -1166,7 +1166,7 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv, vmw_bo_placement_set(vmw_bo, VMW_BO_DOMAIN_MOB, VMW_BO_DOMAIN_MOB); ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo); tmp_bo = vmw_bo; - vmw_user_bo_unref(&tmp_bo); + vmw_bo_unreference(&tmp_bo); if (unlikely(ret != 0)) return ret; @@ -1223,7 +1223,7 @@ static int vmw_translate_guest_ptr(struct vmw_private *dev_priv, VMW_BO_DOMAIN_GMR | VMW_BO_DOMAIN_VRAM); ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo); tmp_bo = vmw_bo; - vmw_user_bo_unref(&tmp_bo); + vmw_bo_unreference(&tmp_bo); if (unlikely(ret != 0)) return ret; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 13b2820cae51..f8158b8d2843 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -1476,8 +1476,8 @@ static int vmw_create_bo_proxy(struct drm_device *dev, /* Reserve and switch the backing mob. */ mutex_lock(&res->dev_priv->cmdbuf_mutex); (void) vmw_resource_reserve(res, false, true); - vmw_user_bo_unref(&res->guest_memory_bo); - res->guest_memory_bo = vmw_user_bo_ref(bo_mob); + vmw_bo_unreference(&res->guest_memory_bo); + res->guest_memory_bo = vmw_bo_reference(bo_mob); res->guest_memory_offset = 0; vmw_resource_unreserve(res, false, false, false, NULL, 0); mutex_unlock(&res->dev_priv->cmdbuf_mutex); @@ -1670,7 +1670,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, err_out: /* vmw_user_lookup_handle takes one ref so does new_fb */ if (bo) - vmw_user_bo_unref(&bo); + vmw_bo_unreference(&bo); if (surface) vmw_surface_unreference(&surface); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c index c45b4724e414..c5860f62ec53 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c @@ -451,7 +451,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data, ret = vmw_overlay_update_stream(dev_priv, buf, arg, true); - vmw_user_bo_unref(&buf); + vmw_bo_unreference(&buf); out_unlock: mutex_unlock(&overlay->mutex); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 848dba09981b..cb786da99fd3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c @@ -141,7 +141,7 @@ static void vmw_resource_release(struct kref *kref) if (res->coherent) vmw_bo_dirty_release(res->guest_memory_bo); ttm_bo_unreserve(bo); - vmw_user_bo_unref(&res->guest_memory_bo); + vmw_bo_unreference(&res->guest_memory_bo); } if (likely(res->hw_destroy != NULL)) { @@ -457,11 +457,11 @@ void vmw_resource_unreserve(struct vmw_resource *res, vmw_resource_mob_detach(res); if (res->coherent) vmw_bo_dirty_release(res->guest_memory_bo); - vmw_user_bo_unref(&res->guest_memory_bo); + vmw_bo_unreference(&res->guest_memory_bo); } if (new_guest_memory_bo) { - res->guest_memory_bo = vmw_user_bo_ref(new_guest_memory_bo); + res->guest_memory_bo = vmw_bo_reference(new_guest_memory_bo); /* * The validation code should already have added a @@ -522,7 +522,7 @@ vmw_resource_check_buffer(struct ww_acquire_ctx *ticket, } INIT_LIST_HEAD(&val_list); - ttm_bo_get(&res->guest_memory_bo->tbo); + drm_gem_object_get(&res->guest_memory_bo->tbo.base); val_buf->bo = &res->guest_memory_bo->tbo; val_buf->num_shared = 0; list_add_tail(&val_buf->head, &val_list); @@ -548,10 +548,10 @@ vmw_resource_check_buffer(struct ww_acquire_ctx *ticket, out_no_validate: ttm_eu_backoff_reservation(ticket, &val_list); out_no_reserve: - ttm_bo_put(val_buf->bo); + drm_gem_object_put(&val_buf->bo->base); val_buf->bo = NULL; if (guest_memory_dirty) - vmw_user_bo_unref(&res->guest_memory_bo); + vmw_bo_unreference(&res->guest_memory_bo); return ret; } @@ -610,7 +610,7 @@ vmw_resource_backoff_reservation(struct ww_acquire_ctx *ticket, INIT_LIST_HEAD(&val_list); list_add_tail(&val_buf->head, &val_list); ttm_eu_backoff_reservation(ticket, &val_list); - ttm_bo_put(val_buf->bo); + drm_gem_object_put(&val_buf->bo->base); val_buf->bo = NULL; } @@ -727,7 +727,7 @@ int vmw_resource_validate(struct vmw_resource *res, bool intr, goto out_no_validate; else if (!res->func->needs_guest_memory && res->guest_memory_bo) { WARN_ON_ONCE(vmw_resource_mob_attached(res)); - vmw_user_bo_unref(&res->guest_memory_bo); + vmw_bo_unreference(&res->guest_memory_bo); } return 0; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c index a01ca3226d0a..6b8e984695ed 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c @@ -180,7 +180,7 @@ static int vmw_gb_shader_init(struct vmw_private *dev_priv, res->guest_memory_size = size; if (byte_code) { - res->guest_memory_bo = vmw_user_bo_ref(byte_code); + res->guest_memory_bo = vmw_bo_reference(byte_code); res->guest_memory_offset = offset; } shader->size = size; @@ -809,7 +809,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv, shader_type, num_input_sig, num_output_sig, tfile, shader_handle); out_bad_arg: - vmw_user_bo_unref(&buffer); + vmw_bo_unreference(&buffer); return ret; } diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index e7a744dfcecf..c275bb074a60 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -1505,7 +1505,7 @@ vmw_gb_surface_define_internal(struct drm_device *dev, if (ret == 0) { if (res->guest_memory_bo->tbo.base.size < res->guest_memory_size) { VMW_DEBUG_USER("Surface backup buffer too small.\n"); - vmw_user_bo_unref(&res->guest_memory_bo); + vmw_bo_unreference(&res->guest_memory_bo); ret = -EINVAL; goto out_unlock; } else { From patchwork Tue Jul 23 12:17:47 2024 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: 13739964 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 BDF62C3DA49 for ; Tue, 23 Jul 2024 12:18:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14E4810E5A5; Tue, 23 Jul 2024 12:18:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QrtNINO4"; dkim-atps=neutral Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id 853F810E5A4 for ; Tue, 23 Jul 2024 12:17:58 +0000 (UTC) Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2ef7fef3ccfso21685801fa.3 for ; Tue, 23 Jul 2024 05:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721737077; x=1722341877; darn=lists.freedesktop.org; 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=3wMHum+UoXT63Pe1yg+we/u4h/jc6mtBqyHZk0WA4yk=; b=QrtNINO4Gqbhwh2cS/QQ9cOBkRKzmqb+X8WyQ3WJtaCv6j0doBLrdcPODhE2zzcFIN UbJNLxWHKP0QkwOYra6q/b1mggSnfZjQdBqdDu+1nPAxCacr732v3b/CjS4cHtpe218u MxuDJk98ODwxUAUSe8lvp1scQC4XQMb9IEj7nNw4jqhYXp4IRlDdl2besdBDfnR4hR8H r7vvpbriEYBvIuvDo58+th+SYxWMy4NH8V0XoM5u+eR0B60zMl2Ku2pziZOPm+AA9gl2 azkSXjwxtKLbOYJ5glydS5iHS+PddBOuEJGru9eHSjUHQBtmnk8dZ10/5nd/A1j46wjg DnEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721737077; x=1722341877; 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=3wMHum+UoXT63Pe1yg+we/u4h/jc6mtBqyHZk0WA4yk=; b=s8bZoWBC6JJfRk8vmONX3Rm4bySAaLMlPqQVhRUgNFHYKC2Cbt2s1wDyQHm8BBGtJl E7uBLSW4DgvYxIX/Nu1tHmUtezwGUFOjUs5sx/xUFBM+IZhWg5PGKka+JZtVdx7TMkW8 zmXy7JocgVM8gIFg6ZH8336ajtVCt92jHupfaQGn/OQLQW/9HgBXAYkPUKMh1cjQ8VVZ POVZ3ENi2jPben2Oo3mQ3U7T013HP0SLX3S8uj/8PPuJPC/B+qEZEDO+3FyIoZ9/t9yu 22Qaz/xGcxpUwHz1vU5e8Vv70jEwtl+6mF5H4V4zlqhwZ3+MIKWMcTxRVWEDY/8jLcDm 3o/g== X-Gm-Message-State: AOJu0Ywb5KrayQ+rgTrtvsxSYC2YJO5cAkZhp5d67L4v/BW+Vhf1ECo6 lxkWmp5WSuWxTAn6r+OMbz12BJv3UvD6RFV8dZ6wXWILplrNTLj7 X-Google-Smtp-Source: AGHT+IHQVjHS4xo4fui6GdNgP9z7WAICe74rnRcyk4kJZ1nUz3Z3uD88iD1hMg2yALuyYcVzCXeM4w== X-Received: by 2002:a05:651c:1a0c:b0:2ef:2dac:9078 with SMTP id 38308e7fff4ca-2ef2dac92e3mr56102941fa.16.1721737076027; Tue, 23 Jul 2024 05:17:56 -0700 (PDT) Received: from able.fritz.box ([2a00:e180:1540:9700:699c:86ac:5633:2a7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427db2a4e3bsm138119595e9.44.2024.07.23.05.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:17:55 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.brost@intel.com, thomas.hellstrom@linux.intel.com Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 5/8] drm/vmwgfx: partially revert "Adapt validation code for reference-free lookups" Date: Tue, 23 Jul 2024 14:17:47 +0200 Message-Id: <20240723121750.2086-5-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723121750.2086-1-christian.koenig@amd.com> References: <20240723121750.2086-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This reverts commit 64ad2abfe9a628ce79859d072704bd1ef7682044. To me it looks like this functionality was never actually used. At least I can't find any protection in vmw_bo_free(). Signed-off-by: Christian König Cc: Zack Rusin Cc: Broadcom internal kernel review list Reviewed-by: Daniel Vetter --- drivers/gpu/drm/vmwgfx/vmwgfx_validation.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c index e7625b3f71e0..e11837e484aa 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.c @@ -262,7 +262,8 @@ int vmw_validation_add_bo(struct vmw_validation_context *ctx, bo_node->hash.key); } val_buf = &bo_node->base; - val_buf->bo = ttm_bo_get_unless_zero(&vbo->tbo); + vmw_bo_reference(vbo); + val_buf->bo = &vbo->tbo; if (!val_buf->bo) return -ESRCH; val_buf->num_shared = 0; @@ -656,7 +657,7 @@ void vmw_validation_unref_lists(struct vmw_validation_context *ctx) struct vmw_validation_res_node *val; list_for_each_entry(entry, &ctx->bo_list, base.head) { - ttm_bo_put(entry->base.bo); + drm_gem_object_put(&entry->base.bo->base); entry->base.bo = NULL; } From patchwork Tue Jul 23 12:17:48 2024 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: 13739970 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 471ECC3DA63 for ; Tue, 23 Jul 2024 12:18:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 802AD10E5A7; Tue, 23 Jul 2024 12:18:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KLgdr/yK"; dkim-atps=neutral Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA1A510E5A5 for ; Tue, 23 Jul 2024 12:17:58 +0000 (UTC) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4266fcb311cso40627405e9.1 for ; Tue, 23 Jul 2024 05:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721737077; x=1722341877; darn=lists.freedesktop.org; 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=JoCfEIkyVorkoZeWDN4wqEB5XnZUJFR8yriQryFtpcM=; b=KLgdr/yKJ49pb0MGzNlaZFpVQedmDpmuYcHGT+decjpQPTw+eFe856DcyLzjf52iAx sIE7WrFrNfKADpID0lFvimglTJXTJHgDxh/nXpFzCAEiEzUEUClFwYgU2FsQLTSc6Vzl AHP0DToiSD2Cpp/0mFzN4hGYnF9OnwvgAiENwjPradCs9IC5jLw114dXy2Ocid7Ga1K8 E8I2wmKwM0O3dJt53tTppO1L/s/Y8ptLM+iUqg9dqYdGJFKWHcdltEcHU+PPdpoYXnPA /b3fyGh+ieqHIGGL/w7+d5QbyJBT08bG72YTQiMb+PGjcGhED6qofOPmx73PEdXtXlAj Wkyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721737077; x=1722341877; 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=JoCfEIkyVorkoZeWDN4wqEB5XnZUJFR8yriQryFtpcM=; b=Cuh+Qoaiq6D04Z6nTi+mrcJ5wwatiFn0swB4dyvzNGlhZWtKnYMs0fkZwJQ/3wLN9o LkOovxgioG+tqcACHn1SAJbo6rWk/rjsu8I6zOYYYVP79HPsIfM2j5W57PeCJdDgf3Wy U6HPDZHknjAQAFdb683bEPW2NnjVd0wSoKzVLgLeXeN4QHugzQDS2jzIu/sq1u8QCeWn 2DxR/D5D67Z9jxi01tR3eK6kKPIqgTJM0I/6CAi5gNp2QFbCmrMa9eLdHnCQtVKV8jBl sd4uXy6l/9HIdnG0h4pt4tZgbk9G1rbnUA72lbuxbJiRbRILLfy5f/odHEWaTtBXyavD i1ag== X-Gm-Message-State: AOJu0YwgSVpF6qe3FGkqyWNI6p4ahV6Sh8onctBKVoqQeXu9RIwYWJPT 6qETSlMdN5d7e0b3BLE7z5SFl+kz4dSWT2I33kvbrhlwpzt9SWJg X-Google-Smtp-Source: AGHT+IGBPtEKMpqHRFJEuokGxhGho/YIUFf65gKsGTM/y3OqSGpFqiAWt2wMf4I5zs+inXrhTk8NTw== X-Received: by 2002:a05:600c:34d6:b0:426:6688:2421 with SMTP id 5b1f17b1804b1-427dc52303emr54437745e9.11.1721737076767; Tue, 23 Jul 2024 05:17:56 -0700 (PDT) Received: from able.fritz.box ([2a00:e180:1540:9700:699c:86ac:5633:2a7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427db2a4e3bsm138119595e9.44.2024.07.23.05.17.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:17:56 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.brost@intel.com, thomas.hellstrom@linux.intel.com Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 6/8] drm/ttm: revert "Export ttm_bo_get_unless_zero()" Date: Tue, 23 Jul 2024 14:17:48 +0200 Message-Id: <20240723121750.2086-6-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723121750.2086-1-christian.koenig@amd.com> References: <20240723121750.2086-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This reverts commit 24dc64c1ba5c3ef0463d59fef6df09336754188d. Shouldn't be needed by drivers any more. Signed-off-by: Christian König Reviewed-by: Matthew Brost Reviewed-by: Daniel Vetter --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + drivers/gpu/drm/ttm/ttm_bo_internal.h | 48 +++++++++++++++++++++++++++ drivers/gpu/drm/ttm/ttm_bo_util.c | 2 ++ drivers/gpu/drm/ttm/ttm_device.c | 1 + include/drm/ttm/ttm_bo.h | 18 ---------- 5 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 drivers/gpu/drm/ttm/ttm_bo_internal.h diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 0131ec802066..fe4638ec0976 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -45,6 +45,7 @@ #include #include "ttm_module.h" +#include "ttm_bo_internal.h" static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo, struct ttm_placement *placement) diff --git a/drivers/gpu/drm/ttm/ttm_bo_internal.h b/drivers/gpu/drm/ttm/ttm_bo_internal.h new file mode 100644 index 000000000000..6a7305efd778 --- /dev/null +++ b/drivers/gpu/drm/ttm/ttm_bo_internal.h @@ -0,0 +1,48 @@ +/* + * Copyright 2018 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * + */ + +#ifndef _TTM_BO_INTERNAL_H_ +#define _TTM_BO_INTERNAL_H_ + +#include + +/** + * ttm_bo_get_unless_zero - reference a struct ttm_buffer_object unless + * its refcount has already reached zero. + * @bo: The buffer object. + * + * Used to reference a TTM buffer object in lookups where the object is removed + * from the lookup structure during the destructor and for RCU lookups. + * + * Returns: @bo if the referencing was successful, NULL otherwise. + */ +static inline __must_check struct ttm_buffer_object * +ttm_bo_get_unless_zero(struct ttm_buffer_object *bo) +{ + if (!kref_get_unless_zero(&bo->kref)) + return NULL; + return bo; +} + +#endif diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 3c07f4712d5c..f7143384ef1c 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -37,6 +37,8 @@ #include +#include "ttm_bo_internal.h" + struct ttm_transfer_obj { struct ttm_buffer_object base; struct ttm_buffer_object *bo; diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index e7cc4954c1bc..2e7fa3a11dc0 100644 --- a/drivers/gpu/drm/ttm/ttm_device.c +++ b/drivers/gpu/drm/ttm/ttm_device.c @@ -36,6 +36,7 @@ #include #include "ttm_module.h" +#include "ttm_bo_internal.h" /* * ttm_global_mutex - protecting the global state diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h index d1a732d56259..31ec7fd34eeb 100644 --- a/include/drm/ttm/ttm_bo.h +++ b/include/drm/ttm/ttm_bo.h @@ -239,24 +239,6 @@ static inline void ttm_bo_get(struct ttm_buffer_object *bo) kref_get(&bo->kref); } -/** - * ttm_bo_get_unless_zero - reference a struct ttm_buffer_object unless - * its refcount has already reached zero. - * @bo: The buffer object. - * - * Used to reference a TTM buffer object in lookups where the object is removed - * from the lookup structure during the destructor and for RCU lookups. - * - * Returns: @bo if the referencing was successful, NULL otherwise. - */ -static inline __must_check struct ttm_buffer_object * -ttm_bo_get_unless_zero(struct ttm_buffer_object *bo) -{ - if (!kref_get_unless_zero(&bo->kref)) - return NULL; - return bo; -} - /** * ttm_bo_reserve: * From patchwork Tue Jul 23 12:17:49 2024 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: 13739968 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 06DB9C3DA49 for ; Tue, 23 Jul 2024 12:18:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E4D310E5A1; Tue, 23 Jul 2024 12:18:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="btDet3W+"; dkim-atps=neutral Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7FF3210E5A6 for ; Tue, 23 Jul 2024 12:17:59 +0000 (UTC) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-42122ac2f38so27687795e9.1 for ; Tue, 23 Jul 2024 05:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721737078; x=1722341878; darn=lists.freedesktop.org; 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=+N9i4doNhAcVvF/B2O0V8BPwngZd2fz/q4Q6R1iaXZY=; b=btDet3W+GuMr9lQHC5vt9Fc+YFATPqLMdehOeB004SSYepKAS54b9zjn0xv15l+bMZ YWVeto/2RxrkLW2GH67LD2pEQvluPvXlIB6SLkuPvByKZVhyDFnbw/GsWIc45EE4B1g/ JvecqQvPIvyY2GoFli5OLHfWDJMrXBKP6/fokaXzj0MlbHIF0S+UG7D3EID6LKi/Wz4z elmSCWLruktwsKabnyX2eaR7Ux+pW+8f0wh59+IcEEW8V39jfuFvHyw8SH3g9Sw3f++5 ZmH59d2CKhqkSul371TCdrj7LIDoPVo3cPDSbf3M3fYqojOBTTHTWcmTN6o8u+hWPZ4b jh6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721737078; x=1722341878; 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=+N9i4doNhAcVvF/B2O0V8BPwngZd2fz/q4Q6R1iaXZY=; b=C0MEqxRA/KyftlUijHpg9ho5PZbmh+ugsH9wTFWWhrr1J67kMrrY2CWl1PzGlW+EpT pRQojnDtxMYwXAPcPbtprlrRoFRf4IEdGYumoOG5h4/IgDo2RMGLxUxLD/9QAlus5/Ue 7ENcoRZcr9Vrap/AZ0i91lnUXaUT6xJEp/BKyh4peCQtSsRJ76BaB+SkabuM6cmf/C9k tUnhZ8aYf01CHihxOXAEbJKBhpzCASN/3Jj8nhFp7YUcj1/gBfioKvD3vGREUqmBN0qt 6ORb+B/x3cAl5/alWVehfIQwq0eCp+U0/MIH1+JAikCQGRVl8+KOVJ7NvsV8ySQsepSk OiVg== X-Gm-Message-State: AOJu0YwWxvJ1WHzM+ys+ie5bEW1LvgOgfBhbZIkS9nxjRg//x3htAF32 E9OXSDdGS6ANTUujfrUJ+BoDpxoI0NjZSxGQnru0ZzYHbNQp6qrG X-Google-Smtp-Source: AGHT+IFpWwPUW5MDi4dWc/4CF4F+jcBcfyPm8tgfpuP5l71v7Gc9nuRtV1Og1nchNaYQwdMYSleFXg== X-Received: by 2002:a05:600c:5129:b0:424:7871:2e9e with SMTP id 5b1f17b1804b1-427ef32e627mr13158605e9.6.1721737077545; Tue, 23 Jul 2024 05:17:57 -0700 (PDT) Received: from able.fritz.box ([2a00:e180:1540:9700:699c:86ac:5633:2a7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427db2a4e3bsm138119595e9.44.2024.07.23.05.17.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:17:57 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.brost@intel.com, thomas.hellstrom@linux.intel.com Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 7/8] drm/ttm: use GEM references for VM mappings Date: Tue, 23 Jul 2024 14:17:49 +0200 Message-Id: <20240723121750.2086-7-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723121750.2086-1-christian.koenig@amd.com> References: <20240723121750.2086-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of a TTM reference grab a GEM reference whenever necessary for a VM mapping. Signed-off-by: Christian König Reviewed-by: Matthew Brost --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 4212b8c91dd4..3f283b3433f8 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -58,13 +58,13 @@ static vm_fault_t ttm_bo_vm_fault_idle(struct ttm_buffer_object *bo, if (vmf->flags & FAULT_FLAG_RETRY_NOWAIT) return VM_FAULT_RETRY; - ttm_bo_get(bo); + drm_gem_object_get(&bo->base); mmap_read_unlock(vmf->vma->vm_mm); (void)dma_resv_wait_timeout(bo->base.resv, DMA_RESV_USAGE_KERNEL, true, MAX_SCHEDULE_TIMEOUT); dma_resv_unlock(bo->base.resv); - ttm_bo_put(bo); + drm_gem_object_put(&bo->base); return VM_FAULT_RETRY; } @@ -130,12 +130,12 @@ vm_fault_t ttm_bo_vm_reserve(struct ttm_buffer_object *bo, */ if (fault_flag_allow_retry_first(vmf->flags)) { if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) { - ttm_bo_get(bo); + drm_gem_object_get(&bo->base); mmap_read_unlock(vmf->vma->vm_mm); if (!dma_resv_lock_interruptible(bo->base.resv, NULL)) dma_resv_unlock(bo->base.resv); - ttm_bo_put(bo); + drm_gem_object_put(&bo->base); } return VM_FAULT_RETRY; @@ -353,7 +353,7 @@ void ttm_bo_vm_open(struct vm_area_struct *vma) WARN_ON(bo->bdev->dev_mapping != vma->vm_file->f_mapping); - ttm_bo_get(bo); + drm_gem_object_get(&bo->base); } EXPORT_SYMBOL(ttm_bo_vm_open); @@ -361,7 +361,7 @@ void ttm_bo_vm_close(struct vm_area_struct *vma) { struct ttm_buffer_object *bo = vma->vm_private_data; - ttm_bo_put(bo); + drm_gem_object_put(&bo->base); vma->vm_private_data = NULL; } EXPORT_SYMBOL(ttm_bo_vm_close); @@ -462,7 +462,7 @@ int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo) if (is_cow_mapping(vma->vm_flags)) return -EINVAL; - ttm_bo_get(bo); + drm_gem_object_get(&bo->base); /* * Drivers may want to override the vm_ops field. Otherwise we From patchwork Tue Jul 23 12:17:50 2024 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: 13739969 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 2163DC3DA63 for ; Tue, 23 Jul 2024 12:18:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA0A710E5A6; Tue, 23 Jul 2024 12:18:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Eb3N4gKy"; dkim-atps=neutral Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4015B10E5A7 for ; Tue, 23 Jul 2024 12:18:00 +0000 (UTC) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4279c10a40eso39675905e9.3 for ; Tue, 23 Jul 2024 05:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721737078; x=1722341878; darn=lists.freedesktop.org; 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=cUZldjCk6CAvoKiy4Qt4KMQRgII+urD/Fno6McOQQ7I=; b=Eb3N4gKyGIwKwNfrT3xjv54W01wUkdwCbJpwAUCjEL0j3aO/g+FRBEgwYhynQE7ckj Hm4gcoVNgmwK5J4SRv/qkha1972UbOiPXuYwvAFdKGMntmddUv/7/y92UjbJvM/XAswU drO7/Bexko9KK1mRnKAq68NvkoT3kHsI/IHA3zoC2C6eif3agVYKHPsiG9ymKzmXTi4Q GJjkjWIUo62/EayHqP5bJgwPB+lSadt63OtWyVS8gMHlEnElwMnhE52wm4SOcgCUNLcL jaJbwf1EbnV1bTvM3Q/GkSFa8VSUBltWGsrr3OxZ4c5i3D90n6lM1L+bKVuo+J3gmv04 0D4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721737078; x=1722341878; 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=cUZldjCk6CAvoKiy4Qt4KMQRgII+urD/Fno6McOQQ7I=; b=ASSAMIKF+0OQ3kyNiEdYS7WUHdYkKsB0t56mxkKKNh5brFReQu3LPEqjOIB8BWjWw3 Rt79NdxowDfJav99rffbT9ut0jZ/XAzn0X+ZMxePNZb2YwS1oi2MU8AVcpSFrfXmaawM Q5Aj8BmWN+RbPIY8J9WbkIt6iQ8lMT8xT1l06MxTwzZoH8pCuV8yv6DjmCsD3RfALzHb V6TL2XyA9hTEsKZ4/yV7V923dfoS+y95SxuWQKRVgp36tmA4Ko8dExMJ6hVy5v8QYqm6 ynknWzwknVn5HjVC/ooe6zNp5WqhpJX9FSCiObUVQ+KCynIQUIssp9lsseL5Sm2x82hU S+7w== X-Gm-Message-State: AOJu0YyDorYKH22iGhVW53Nl1jkFi/kUU9ySQHzGUqUevf237JNBu/fL t+fBwwdgg/WlfejIbscDwN6Le2hycPfTfxTSvgvfN/AqUgjUfTG6 X-Google-Smtp-Source: AGHT+IET571dQTjR4rt2yhVnfbGT2dxzDFbwyByZKKHoJj9VzNBjh5TZXVQMDXuMBadFevTY9uPtjA== X-Received: by 2002:a05:600c:314b:b0:425:80d5:b8b2 with SMTP id 5b1f17b1804b1-427dc527fc3mr56440755e9.16.1721737078286; Tue, 23 Jul 2024 05:17:58 -0700 (PDT) Received: from able.fritz.box ([2a00:e180:1540:9700:699c:86ac:5633:2a7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427db2a4e3bsm138119595e9.44.2024.07.23.05.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 05:17:57 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: matthew.brost@intel.com, thomas.hellstrom@linux.intel.com Cc: dri-devel@lists.freedesktop.org Subject: [PATCH 8/8] drm/ttm: make ttm_bo_get internal Date: Tue, 23 Jul 2024 14:17:50 +0200 Message-Id: <20240723121750.2086-8-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723121750.2086-1-christian.koenig@amd.com> References: <20240723121750.2086-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Prevent drivers from using this directly. Signed-off-by: Christian König Reviewed-by: Matthew Brost --- drivers/gpu/drm/ttm/ttm_bo_internal.h | 10 ++++++++++ include/drm/ttm/ttm_bo.h | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_internal.h b/drivers/gpu/drm/ttm/ttm_bo_internal.h index 6a7305efd778..9d8b747a34db 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_internal.h +++ b/drivers/gpu/drm/ttm/ttm_bo_internal.h @@ -27,6 +27,16 @@ #include +/** + * ttm_bo_get - reference a struct ttm_buffer_object + * + * @bo: The buffer object. + */ +static inline void ttm_bo_get(struct ttm_buffer_object *bo) +{ + kref_get(&bo->kref); +} + /** * ttm_bo_get_unless_zero - reference a struct ttm_buffer_object unless * its refcount has already reached zero. diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h index 31ec7fd34eeb..8c1577d8793c 100644 --- a/include/drm/ttm/ttm_bo.h +++ b/include/drm/ttm/ttm_bo.h @@ -229,16 +229,6 @@ struct ttm_lru_walk { s64 ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev, struct ttm_resource_manager *man, s64 target); -/** - * ttm_bo_get - reference a struct ttm_buffer_object - * - * @bo: The buffer object. - */ -static inline void ttm_bo_get(struct ttm_buffer_object *bo) -{ - kref_get(&bo->kref); -} - /** * ttm_bo_reserve: *