From patchwork Fri Jun 10 13:54:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michel_D=C3=A4nzer?= X-Patchwork-Id: 12877641 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 1B5F1CCA47D for ; Fri, 10 Jun 2022 14:01:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D7198112389; Fri, 10 Jun 2022 14:01:28 +0000 (UTC) X-Greylist: delayed 415 seconds by postgrey-1.36 at gabe; Fri, 10 Jun 2022 14:01:27 UTC Received: from ms7.webland.ch (ms7.webland.ch [92.43.217.107]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1EB7A112389; Fri, 10 Jun 2022 14:01:26 +0000 (UTC) Received: from kaveri ([85.2.99.24]) by ms7.webland.ch (12.3.0 build 2 x64) with ASMTP (SSL) id 01202206101554279829; Fri, 10 Jun 2022 15:54:27 +0200 Received: from daenzer by kaveri with local (Exim 4.95) (envelope-from ) id 1nzf5m-002oKZ-Ca; Fri, 10 Jun 2022 15:54:26 +0200 From: =?utf-8?q?Michel_D=C3=A4nzer?= To: Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan Subject: [PATCH] drm/amdgpu: Fix GTT size reporting in amdgpu_ioctl Date: Fri, 10 Jun 2022 15:54:26 +0200 Message-Id: <20220610135426.670120-1-michel@daenzer.net> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-CTCH: RefID="str=0001.0A782F18.62A34D15.0003,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0"; Spam="Unknown"; VOD="Unknown" 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: , Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Michel Dänzer The commit below changed the TTM manager size unit from pages to bytes, but failed to adjust the corresponding calculations in amdgpu_ioctl. Fixes: dfa714b88eb0 ("drm/amdgpu: remove GTT accounting v2") Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1930 Bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6642 Signed-off-by: Michel Dänzer Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 801f6fa692e9..6de63ea6687e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -642,7 +642,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) atomic64_read(&adev->visible_pin_size), vram_gtt.vram_size); vram_gtt.gtt_size = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT)->size; - vram_gtt.gtt_size *= PAGE_SIZE; vram_gtt.gtt_size -= atomic64_read(&adev->gart_pin_size); return copy_to_user(out, &vram_gtt, min((size_t)size, sizeof(vram_gtt))) ? -EFAULT : 0; @@ -675,7 +674,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) mem.cpu_accessible_vram.usable_heap_size * 3 / 4; mem.gtt.total_heap_size = gtt_man->size; - mem.gtt.total_heap_size *= PAGE_SIZE; mem.gtt.usable_heap_size = mem.gtt.total_heap_size - atomic64_read(&adev->gart_pin_size); mem.gtt.heap_usage = ttm_resource_manager_usage(gtt_man);