From patchwork Wed Feb 19 13:53:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11391787 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E2D7139A for ; Wed, 19 Feb 2020 16:18:32 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E01942067D for ; Wed, 19 Feb 2020 16:18:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Up9Ps0Md" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E01942067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E2916EC45; Wed, 19 Feb 2020 16:18:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id F3E9F6EBEF; Wed, 19 Feb 2020 13:50:42 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id n10so666105wrm.1; Wed, 19 Feb 2020 05:50:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E2IXVDGpv1LWW0i5P2Dw6K77dUCtFyyfq4K86eQ0oZ8=; b=Up9Ps0MdYSLFmGOZ/EGiv43FpJlEmmjZaC1UYsRWF2oiR8ohx4KP2Xw/vNzA4MNU4A 2Nzx0nqLgKliJXDL9FZSWBX0HXKyRQPYQ6MzgQLXiYU6RSxVw4mlUxMGPl6vr+ikaLKi 02OaBA8YA2dhU0ncbdGX9OJI/3r3T+QdR3JGNHblBbxqa9aXHi9g+3z+KptPtq5eiKoz OlaUGAZ5zWmSt+C59Wq7P60p7SdbEE4dV6FARu3LA8MavTAZeiIO7p4FZVkcphrJ7Cfa SopTmdLl9rAGqFMPtmSDGyrE3iZYgjEgqebEptMT86dsEe6+98CbbnvV2o6lDssbSxj5 ys+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E2IXVDGpv1LWW0i5P2Dw6K77dUCtFyyfq4K86eQ0oZ8=; b=WdQDBQue1E/GuAu8s1A848EchqEkZm1yj+WndgG9vkNZ2pf24T/MjI79sbrLP88K0e 2kz0h3ZW7LwuXAZVMhkdHzzsmhyr9dQLAejXKUvkJ64/WPK9k1PhMoCHAKj4tfd9jw7o zABnY5cCeNH0CYwqTzLQI1m/H3jken3T931j2Vr2nvHNRwcaCioQn6pENuy8rJ1R7dl2 0MUJ8/ZK/MWgAr51SqctJaRhc57K7pXqsmW0fFEitJV5EGbXjIMFujpIMYmhoQ/xffzZ XGydXX1yeYX3RP0M8VOZEU0rF/Gtf16ewbo1qYyk/jBIalIahXR0GhhGhRR7ofpo6pVd HyCw== X-Gm-Message-State: APjAAAUUScFf+TaeaqQwAugsZRkYIh+e5Sc4M0dHMcxXaRFY4NXPqnNN Bp68CbIwb+rVvBAG9MJDp7PmJCWHUkaIPA== X-Google-Smtp-Source: APXvYqz3SraG3qip0Mmla1vjNXg8bua+u61inhCmlaWRKSVi5Cpu/hl8UUsVYNKlrQ7HluUg3T8Q7g== X-Received: by 2002:adf:fd43:: with SMTP id h3mr35742550wrs.169.1582120241265; Wed, 19 Feb 2020 05:50:41 -0800 (PST) Received: from brihaspati.fritz.box (p5DE53754.dip0.t-ipconnect.de. [93.229.55.84]) by smtp.gmail.com with ESMTPSA id y1sm3061881wrq.16.2020.02.19.05.50.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 05:50:40 -0800 (PST) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/8] drm/amdgpu: move ttm bo->offset to amdgpu_bo Date: Wed, 19 Feb 2020 14:53:15 +0100 Message-Id: <20200219135322.56463-2-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200219135322.56463-1-nirmoy.das@amd.com> References: <20200219135322.56463-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Feb 2020 16:18:11 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, amd-gfx@lists.freedesktop.org, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, Huang Rui , sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" GPU address should belong to driver not in memory management. This patch moves ttm bo.offset and gpu_offset calculation to amdgpu driver. Signed-off-by: Nirmoy Das Acked-by: Huang Rui Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 22 ++++++++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 29 ++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 1 + 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index e3f16b49e970..04e78f783638 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -917,7 +917,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, bo->pin_count++; if (max_offset != 0) { - u64 domain_start = bo->tbo.bdev->man[mem_type].gpu_offset; + u64 domain_start = amdgpu_ttm_domain_start(adev, mem_type); WARN_ON_ONCE(max_offset < (amdgpu_bo_gpu_offset(bo) - domain_start)); } @@ -1445,7 +1445,25 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo) WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_VRAM && !(bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)); - return amdgpu_gmc_sign_extend(bo->tbo.offset); + return amdgpu_bo_gpu_offset_no_check(bo); +} + +/** + * amdgpu_bo_gpu_offset_no_check - return GPU offset of bo + * @bo: amdgpu object for which we query the offset + * + * Returns: + * current GPU offset of the object without raising warnings. + */ +u64 amdgpu_bo_gpu_offset_no_check(struct amdgpu_bo *bo) +{ + struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); + uint64_t offset; + + offset = (bo->tbo.mem.start << PAGE_SHIFT) + + amdgpu_ttm_domain_start(adev, bo->tbo.mem.mem_type); + + return amdgpu_gmc_sign_extend(offset); } /** diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 36dec51d1ef1..1d86b4c7a1f2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h @@ -279,6 +279,7 @@ void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence, bool shared); int amdgpu_bo_sync_wait(struct amdgpu_bo *bo, void *owner, bool intr); u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo); +u64 amdgpu_bo_gpu_offset_no_check(struct amdgpu_bo *bo); int amdgpu_bo_validate(struct amdgpu_bo *bo); int amdgpu_bo_restore_shadow(struct amdgpu_bo *shadow, struct dma_fence **fence); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 3ab46d4647e4..e329a108e760 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -97,7 +97,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, case TTM_PL_TT: /* GTT memory */ man->func = &amdgpu_gtt_mgr_func; - man->gpu_offset = adev->gmc.gart_start; man->available_caching = TTM_PL_MASK_CACHING; man->default_caching = TTM_PL_FLAG_CACHED; man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA; @@ -105,7 +104,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, case TTM_PL_VRAM: /* "On-card" video ram */ man->func = &amdgpu_vram_mgr_func; - man->gpu_offset = adev->gmc.vram_start; man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC; @@ -116,7 +114,6 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, case AMDGPU_PL_OA: /* On-chip GDS memory*/ man->func = &ttm_bo_manager_func; - man->gpu_offset = 0; man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_CMA; man->available_caching = TTM_PL_FLAG_UNCACHED; man->default_caching = TTM_PL_FLAG_UNCACHED; @@ -264,7 +261,7 @@ static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo, if (mm_node->start != AMDGPU_BO_INVALID_OFFSET) { addr = mm_node->start << PAGE_SHIFT; - addr += bo->bdev->man[mem->mem_type].gpu_offset; + addr += amdgpu_ttm_domain_start(amdgpu_ttm_adev(bo->bdev), mem->mem_type); } return addr; } @@ -751,6 +748,27 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo, (offset >> PAGE_SHIFT); } +/** + * amdgpu_ttm_domain_start - Returns GPU start address + * @adev: amdgpu device object + * @type: type of the memory + * + * Returns: + * GPU start address of a memory domain + */ + +uint64_t amdgpu_ttm_domain_start(struct amdgpu_device *adev, uint32_t type) +{ + switch(type) { + case TTM_PL_TT: + return adev->gmc.gart_start; + case TTM_PL_VRAM: + return adev->gmc.vram_start; + } + + return 0; +} + /* * TTM backend functions. */ @@ -1162,9 +1180,6 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo) bo->mem = tmp; } - bo->offset = (bo->mem.start << PAGE_SHIFT) + - bo->bdev->man[bo->mem.mem_type].gpu_offset; - return 0; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h index 0dddedc06ae3..2c90a95c4b27 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h @@ -102,6 +102,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma); int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo); int amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo); +uint64_t amdgpu_ttm_domain_start(struct amdgpu_device *adev, uint32_t type); #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR) int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages); From patchwork Wed Feb 19 13:53:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11391779 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8782813A4 for ; Wed, 19 Feb 2020 16:18:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 660292067D for ; Wed, 19 Feb 2020 16:18:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FfcgVpIX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 660292067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D99FA89C96; Wed, 19 Feb 2020 16:18:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 316326EBF1; Wed, 19 Feb 2020 13:50:46 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id w12so655853wrt.2; Wed, 19 Feb 2020 05:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bWJVvbyji5lv93ku6dxciulHZbwF+rGmjiubbT57gkM=; b=FfcgVpIXuA6Uu2tr7kaJzV6S70uVk+xdHWWVo9xgYG7HsGD26tM9iziXlrgJGthMNL 5vlxUgZQcLDhx4zLj7RrK0qoEUA7Bh2eBS2oZA6DSo+5qVDjAGN3mX/+MBG4VZU5h0E2 YMgf1mb8tQP+0ndyWZoQd1OeKF+eCYDIrZxA/TnfC8VeR8Y24lwNy6Vo6Jj5JJKxlC0k a1QcPg0AS36d1HOBh81vNSmuTBSxWVzzxL79Ro8DvqSmx9ezahnujhKAOPjccJXx1ety 59PGYauywqd1X1KkXisGKVYObX62AdqgFWysnPQTu34r1rHQ5b4P6XGmQCiq8KVEN7Sj zsLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bWJVvbyji5lv93ku6dxciulHZbwF+rGmjiubbT57gkM=; b=uJhY58dKBHD39o+B8ahtGccnQHTztnT2QPdxFUbxhj6EJvQ+HGrtbyz0a8K+dTZ2G9 sRZq36aLr0kjKuUIAgUzgfBh7uygU1ER2z2+RTZDfFm8xcPml+N229smpU+1rQ11bj2H /slFnSMuTIRIwdR9sihMT9SbGpYokpFDWWM4W2wG9DBN9YPKpqeFL5Fquyi4ehbaE4bJ hKe27PWgc7OQd2lMsgmh1UKVMfjizG+zLYJKJLZ0E78GDCaWmyf4uIuRtnO6rSnZF+qa 18FY4WfH+LVHgqR3TFvUCjHQsQAySntqMve1gFLC+27+DQw1I6u1Z6h6B0lFDMbWWq3D Bc1Q== X-Gm-Message-State: APjAAAWobkPwWw1qyJXagkIUcrYcXXSONo1bsIRs9Ri9/YKCAX6HW3Ok b9hpO7AxZnPrsOdONlnsDXLBkkWwZOCIFQ== X-Google-Smtp-Source: APXvYqxAN8BgC23ZDIvOTe3hFC4I0/SvosvvXkP1g5fGVbNNeSCDEEajNPBNLCWd5lYTzFh0tJ1jEg== X-Received: by 2002:a5d:6a0f:: with SMTP id m15mr37745072wru.40.1582120244440; Wed, 19 Feb 2020 05:50:44 -0800 (PST) Received: from brihaspati.fritz.box (p5DE53754.dip0.t-ipconnect.de. [93.229.55.84]) by smtp.gmail.com with ESMTPSA id y1sm3061881wrq.16.2020.02.19.05.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 05:50:43 -0800 (PST) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/8] drm/radeon: don't use ttm bo->offset Date: Wed, 19 Feb 2020 14:53:16 +0100 Message-Id: <20200219135322.56463-3-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200219135322.56463-1-nirmoy.das@amd.com> References: <20200219135322.56463-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Feb 2020 16:18:11 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, amd-gfx@lists.freedesktop.org, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Calculate GPU offset in radeon_bo_gpu_offset without depending on bo->offset Signed-off-by: Nirmoy Das Reviewed-and-tested-by: Christian König --- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_object.h | 16 +++++++++++++++- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 30e32adc1fc6..b7c3fb2bfb54 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -2828,6 +2828,7 @@ extern void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size extern void radeon_program_register_sequence(struct radeon_device *rdev, const u32 *registers, const u32 array_size); +struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev); /* * vm diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index d23f2ed4126e..4d37571c7ff5 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -90,7 +90,21 @@ static inline void radeon_bo_unreserve(struct radeon_bo *bo) */ static inline u64 radeon_bo_gpu_offset(struct radeon_bo *bo) { - return bo->tbo.offset; + struct radeon_device *rdev; + u64 start = 0; + + rdev = radeon_get_rdev(bo->tbo.bdev); + + switch(bo->tbo.mem.mem_type) { + case TTM_PL_TT: + start = rdev->mc.gtt_start; + break; + case TTM_PL_VRAM: + start = rdev->mc.vram_start; + break; + } + + return (bo->tbo.mem.start << PAGE_SHIFT) + start; } static inline unsigned long radeon_bo_size(struct radeon_bo *bo) diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index badf1b6d1549..1c8303468e8f 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -56,7 +56,7 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev); static void radeon_ttm_debugfs_fini(struct radeon_device *rdev); -static struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev) +struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev) { struct radeon_mman *mman; struct radeon_device *rdev; @@ -82,7 +82,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, break; case TTM_PL_TT: man->func = &ttm_bo_manager_func; - man->gpu_offset = rdev->mc.gtt_start; man->available_caching = TTM_PL_MASK_CACHING; man->default_caching = TTM_PL_FLAG_CACHED; man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA; @@ -104,7 +103,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, case TTM_PL_VRAM: /* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->gpu_offset = rdev->mc.vram_start; man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC; From patchwork Wed Feb 19 13:53:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11391775 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5AFE13A4 for ; Wed, 19 Feb 2020 16:18:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 841E22067D for ; Wed, 19 Feb 2020 16:18:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="baE/w8SC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 841E22067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 76A8E897DC; Wed, 19 Feb 2020 16:18:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id C989C6EBF3; Wed, 19 Feb 2020 13:50:47 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id k11so598166wrd.9; Wed, 19 Feb 2020 05:50:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mPvoLkggG7ZMHTLm9jQ6uQeOIROIduldbyLICT5Lh6A=; b=baE/w8SC2QPplRwge3PJiRxKCyLRR7lUcs0Dbyn8k1i480HY2u/84vDiM+pFDRdtzS vetvZ2g6ziMplcgvypsqUFuPyV6rhzXavIJKu/uMCAuLDSZznFwtGdgJjnXiHYFOp01u W0x/5DOw+SfpStTLLr80f8RaHUShTAyNl4xjrNwZ5MJ474sRm+yIFAqWX14FyHkN/uZx /UlKABMyy8DISoGmtg/UXw2X5gArgP32F3+6Mym6ef8CY3OJtAPfri9EY19SB04G3e4F esFbPtsAxNgAaSI3h0t9WYphri+IMH5hw8t7ogD0KYH78CZ1QjKUmsrszhAVgY7BR9qN Dn+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mPvoLkggG7ZMHTLm9jQ6uQeOIROIduldbyLICT5Lh6A=; b=fBCu4nGRQAU589CzWMKBoEzuA97QpWW1EzgiJimTB2hSf8eZPxQJ+vEtDYzE1sivrV wPcPSXVzHSUkIrYMxloyQOmL/qrijxSlvN2fuxhBp6U+7qDSvAq6LaeNuMEBH23JMn0P ZmgoFqVSvUXk0jmObOgbyrOlucXu+98QDEvr3pk4PqDnU2TRqOE+nchYZ1lhnN5XM0ox /RL/PG+15vRZYnIu+2uXmEum0pSbv+85/rnj3+SxsjYB17BOZaDbQq51Lj2YGqTX3IJj /pUXtjbwgWN6FRE0640mfTbK1kE5KUi0BF76q0QV+RYVD+qDNcpGMZaP3FhzG7uRWHhj v88g== X-Gm-Message-State: APjAAAWAqG2pyZSGAZg3cydIGSH2Qg9AA8slOZIqgBJl1vqxrQgQGtYT PTaC3TdQPHwnebMElllBYkpwLEDHsoT4WQ== X-Google-Smtp-Source: APXvYqwrAGhSzOJyIe5pF0vfyO5QC8QqNP0MmkdZ7YBHqHzPtq7IK/QZ0T4UzbpNeH5MxAnQ20/AFA== X-Received: by 2002:adf:82ce:: with SMTP id 72mr36053180wrc.14.1582120246087; Wed, 19 Feb 2020 05:50:46 -0800 (PST) Received: from brihaspati.fritz.box (p5DE53754.dip0.t-ipconnect.de. [93.229.55.84]) by smtp.gmail.com with ESMTPSA id y1sm3061881wrq.16.2020.02.19.05.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 05:50:45 -0800 (PST) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/8] drm/vmwgfx: don't use ttm bo->offset Date: Wed, 19 Feb 2020 14:53:17 +0100 Message-Id: <20200219135322.56463-4-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200219135322.56463-1-nirmoy.das@amd.com> References: <20200219135322.56463-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Feb 2020 16:18:11 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, amd-gfx@lists.freedesktop.org, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Calculate GPU offset within vmwgfx driver itself without depending on bo->offset Signed-off-by: Nirmoy Das Acked-by: Christian König Tested-by: Thomas Hellstrom Acked-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c index 8b71bf6b58ef..1e59c019affa 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c @@ -258,7 +258,7 @@ int vmw_bo_pin_in_start_of_vram(struct vmw_private *dev_priv, ret = ttm_bo_validate(bo, &placement, &ctx); /* For some reason we didn't end up at the start of vram */ - WARN_ON(ret == 0 && bo->offset != 0); + WARN_ON(ret == 0 && bo->mem.start != 0); if (!ret) vmw_bo_pin_reserved(buf, true); @@ -317,7 +317,7 @@ void vmw_bo_get_guest_ptr(const struct ttm_buffer_object *bo, { if (bo->mem.mem_type == TTM_PL_VRAM) { ptr->gmrId = SVGA_GMR_FRAMEBUFFER; - ptr->offset = bo->offset; + ptr->offset = bo->mem.start << PAGE_SHIFT; } else { ptr->gmrId = bo->mem.start; ptr->offset = 0; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 73489a45decb..72c2cf4053df 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -3313,7 +3313,7 @@ static void vmw_apply_relocations(struct vmw_sw_context *sw_context) bo = &reloc->vbo->base; switch (bo->mem.mem_type) { case TTM_PL_VRAM: - reloc->location->offset += bo->offset; + reloc->location->offset += bo->mem.start << PAGE_SHIFT; reloc->location->gmrId = SVGA_GMR_FRAMEBUFFER; break; case VMW_PL_GMR: diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index e5252ef3812f..1cdc445b24c3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c @@ -612,7 +612,7 @@ static int vmw_fifo_emit_dummy_legacy_query(struct vmw_private *dev_priv, if (bo->mem.mem_type == TTM_PL_VRAM) { cmd->body.guestResult.gmrId = SVGA_GMR_FRAMEBUFFER; - cmd->body.guestResult.offset = bo->offset; + cmd->body.guestResult.offset = bo->mem.start << PAGE_SHIFT; } else { cmd->body.guestResult.gmrId = bo->mem.start; cmd->body.guestResult.offset = 0; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c index 3f3b2c7a208a..e7134aebeb81 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c @@ -750,7 +750,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, case TTM_PL_VRAM: /* "On-card" video ram */ man->func = &ttm_bo_manager_func; - man->gpu_offset = 0; man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; man->available_caching = TTM_PL_FLAG_CACHED; man->default_caching = TTM_PL_FLAG_CACHED; @@ -763,7 +762,6 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, * slots as well as the bo size. */ man->func = &vmw_gmrid_manager_func; - man->gpu_offset = 0; man->flags = TTM_MEMTYPE_FLAG_CMA | TTM_MEMTYPE_FLAG_MAPPABLE; man->available_caching = TTM_PL_FLAG_CACHED; man->default_caching = TTM_PL_FLAG_CACHED; From patchwork Wed Feb 19 13:53:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11391785 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43D3B13A4 for ; Wed, 19 Feb 2020 16:18:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1D8F12067D for ; Wed, 19 Feb 2020 16:18:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fPsQpXPR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D8F12067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D2C5F6EC48; Wed, 19 Feb 2020 16:18:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6B406EBF3; Wed, 19 Feb 2020 13:50:49 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id n3so717195wmk.4; Wed, 19 Feb 2020 05:50:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gzph3wV2q67mGjKj0zDqaIZolRUvv6IUrHrSZD4Fr9M=; b=fPsQpXPRT/vMoBOvNcc195NpYfsvzVdOtMErSdOo+e7nxo6DhZfuyMgItq4w8Pv5bp U+JxaWo5uo//iDyVFShd5KrsCczF4c+QZA6FY3KMrjlCRV8SEhftBst9Qj1dIIxYR3Oj IJr5f7cTJRpXeJaqXryYfffEaF35iSoefTgVF72UZ1pPQCPyqc4yACVMULqLRwPIDFtz cpmtZmBFDd9WZwAlBFaNkLgS6SBnIsj/txOggeiAkuts0Jv13k0rR5e0+1BHAD+RB1ho 2TbbkcmPZFK/AcNcqMEYN3OU/5fmChJ/fZ9kTVxeNfLChHyfSmeDt+oH886o1nCobkxO LFdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gzph3wV2q67mGjKj0zDqaIZolRUvv6IUrHrSZD4Fr9M=; b=jLVy3pnpgv4PuBJiZ9HMuVd7OA65HYvsJj8bcNk+x4GUJOo55ub77oADb5nveNP5fZ LCsIWPNF/Oy01F59VFn4IagpBuACpdG/A1esfODaeKJFbypobZkbYr5lTtqdI8cVfC/Z za5xlu9rfMuR127ySOfpOVEFvHPDlWRz4pnAYgFnGEFEUgYjPfPQUjBkaZG5AOWz8gvF 8gQQhOZJDsP34Qx2/oaKcjCinX/0i2xfAVUq5dgrNVzdDTg2QiSURLAp8NGugnqGPHb/ paYqrhQGTqdYrrhzOgGLav4YvTgY4abdXjtFsOIzr/7C7neONBLbxUTnnH9YLBCYwF+o 8YKQ== X-Gm-Message-State: APjAAAUUDdv5Iu1p4Rqzis2BCLjGMJpAYh+BHDr0cCtWP241aMlEafBg JkMKEZ9dhiDoJOjbqn0+IQIY5tQPiBR+Ig== X-Google-Smtp-Source: APXvYqzhRFK+EKRsM16gY2iE11SQDwU5B0PEwFpGVfnJTJRDbAuvDH8iGNmaGkUk/I2TV1U0STNVhA== X-Received: by 2002:a1c:20d6:: with SMTP id g205mr10579932wmg.38.1582120247789; Wed, 19 Feb 2020 05:50:47 -0800 (PST) Received: from brihaspati.fritz.box (p5DE53754.dip0.t-ipconnect.de. [93.229.55.84]) by smtp.gmail.com with ESMTPSA id y1sm3061881wrq.16.2020.02.19.05.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 05:50:47 -0800 (PST) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/8] drm/nouveau: don't use ttm bo->offset v3 Date: Wed, 19 Feb 2020 14:53:18 +0100 Message-Id: <20200219135322.56463-5-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200219135322.56463-1-nirmoy.das@amd.com> References: <20200219135322.56463-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Feb 2020 16:18:11 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, amd-gfx@lists.freedesktop.org, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Store ttm bo->offset in struct nouveau_bo instead. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/disp.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/overlay.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv50/base507c.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/core507d.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/ovly507e.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndw.c | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c | 2 +- drivers/gpu/drm/nouveau/nouveau_abi16.c | 8 ++++---- drivers/gpu/drm/nouveau/nouveau_bo.c | 8 ++++++++ drivers/gpu/drm/nouveau/nouveau_bo.h | 3 +++ drivers/gpu/drm/nouveau/nouveau_chan.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 10 +++++----- 15 files changed, 35 insertions(+), 24 deletions(-) -- 2.25.0 diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index 1f08de4241e0..d06a93f2b38a 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -845,7 +845,7 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, fb = nouveau_framebuffer(crtc->primary->fb); } - nv_crtc->fb.offset = fb->nvbo->bo.offset; + nv_crtc->fb.offset = fb->nvbo->offset; if (nv_crtc->lut.depth != drm_fb->format->depth) { nv_crtc->lut.depth = drm_fb->format->depth; @@ -1013,7 +1013,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, nv04_cursor_upload(dev, cursor, nv_crtc->cursor.nvbo); nouveau_bo_unmap(cursor); - nv_crtc->cursor.offset = nv_crtc->cursor.nvbo->bo.offset; + nv_crtc->cursor.offset = nv_crtc->cursor.nvbo->offset; nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.offset); nv_crtc->cursor.show(nv_crtc, true); out: @@ -1191,7 +1191,7 @@ nv04_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, /* Initialize a page flip struct */ *s = (struct nv04_page_flip_state) { { }, event, crtc, fb->format->cpp[0] * 8, fb->pitches[0], - new_bo->bo.offset }; + new_bo->offset }; /* Keep vblanks on during flip, for the target crtc of this flip */ drm_crtc_vblank_get(crtc); diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c index 44ee82d0c9b6..89a4ddfcc55f 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c @@ -151,7 +151,7 @@ nv04_display_init(struct drm_device *dev, bool resume, bool runtime) continue; if (nv_crtc->cursor.set_offset) - nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.nvbo->bo.offset); + nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.nvbo->offset); nv_crtc->cursor.set_pos(nv_crtc, nv_crtc->cursor_saved_x, nv_crtc->cursor_saved_y); } diff --git a/drivers/gpu/drm/nouveau/dispnv04/overlay.c b/drivers/gpu/drm/nouveau/dispnv04/overlay.c index a3a0a73ae8ab..9529bd9053e7 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/overlay.c +++ b/drivers/gpu/drm/nouveau/dispnv04/overlay.c @@ -150,7 +150,7 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, nvif_mask(dev, NV_PCRTC_ENGINE_CTRL + soff2, NV_CRTC_FSEL_OVERLAY, 0); nvif_wr32(dev, NV_PVIDEO_BASE(flip), 0); - nvif_wr32(dev, NV_PVIDEO_OFFSET_BUFF(flip), nv_fb->nvbo->bo.offset); + nvif_wr32(dev, NV_PVIDEO_OFFSET_BUFF(flip), nv_fb->nvbo->offset); nvif_wr32(dev, NV_PVIDEO_SIZE_IN(flip), src_h << 16 | src_w); nvif_wr32(dev, NV_PVIDEO_POINT_IN(flip), src_y << 16 | src_x); nvif_wr32(dev, NV_PVIDEO_DS_DX(flip), (src_w << 20) / crtc_w); @@ -172,7 +172,7 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, if (format & NV_PVIDEO_FORMAT_PLANAR) { nvif_wr32(dev, NV_PVIDEO_UVPLANE_BASE(flip), 0); nvif_wr32(dev, NV_PVIDEO_UVPLANE_OFFSET_BUFF(flip), - nv_fb->nvbo->bo.offset + fb->offsets[1]); + nv_fb->nvbo->offset + fb->offsets[1]); } nvif_wr32(dev, NV_PVIDEO_FORMAT(flip), format | fb->pitches[0]); nvif_wr32(dev, NV_PVIDEO_STOP, 0); @@ -396,7 +396,7 @@ nv04_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, for (i = 0; i < 2; i++) { nvif_wr32(dev, NV_PVIDEO_BUFF0_START_ADDRESS + 4 * i, - nv_fb->nvbo->bo.offset); + nv_fb->nvbo->offset); nvif_wr32(dev, NV_PVIDEO_BUFF0_PITCH_LENGTH + 4 * i, fb->pitches[0]); nvif_wr32(dev, NV_PVIDEO_BUFF0_OFFSET + 4 * i, 0); diff --git a/drivers/gpu/drm/nouveau/dispnv50/base507c.c b/drivers/gpu/drm/nouveau/dispnv50/base507c.c index 00a85f1e1a4a..67829f04b2c7 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/base507c.c +++ b/drivers/gpu/drm/nouveau/dispnv50/base507c.c @@ -274,7 +274,7 @@ base507c_new_(const struct nv50_wndw_func *func, const u32 *format, ret = nv50_dmac_create(&drm->client.device, &disp->disp->object, &oclass, head, &args, sizeof(args), - disp->sync->bo.offset, &wndw->wndw); + disp->sync->offset, &wndw->wndw); if (ret) { NV_ERROR(drm, "base%04x allocation failed: %d\n", oclass, ret); return ret; diff --git a/drivers/gpu/drm/nouveau/dispnv50/core507d.c b/drivers/gpu/drm/nouveau/dispnv50/core507d.c index e7fcfa6e6467..793dcb2ea196 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/core507d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/core507d.c @@ -99,7 +99,7 @@ core507d_new_(const struct nv50_core_func *func, struct nouveau_drm *drm, ret = nv50_dmac_create(&drm->client.device, &disp->disp->object, &oclass, 0, &args, sizeof(args), - disp->sync->bo.offset, &core->chan); + disp->sync->offset, &core->chan); if (ret) { NV_ERROR(drm, "core%04x allocation failed: %d\n", oclass, ret); return ret; diff --git a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c index 8ccd96113bad..4cce1078140a 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c @@ -186,7 +186,7 @@ ovly507e_new_(const struct nv50_wndw_func *func, const u32 *format, ret = nv50_dmac_create(&drm->client.device, &disp->disp->object, &oclass, 0, &args, sizeof(args), - disp->sync->bo.offset, &wndw->wndw); + disp->sync->offset, &wndw->wndw); if (ret) { NV_ERROR(drm, "ovly%04x allocation failed: %d\n", oclass, ret); return ret; diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c b/drivers/gpu/drm/nouveau/dispnv50/wndw.c index 890315291b01..e90ffa4a5230 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c @@ -509,7 +509,7 @@ nv50_wndw_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state) } asyw->state.fence = dma_resv_get_excl_rcu(fb->nvbo->bo.base.resv); - asyw->image.offset[0] = fb->nvbo->bo.offset; + asyw->image.offset[0] = fb->nvbo->offset; if (wndw->func->prepare) { asyh = nv50_head_atom_get(asyw->state.state, asyw->state.crtc); diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c index b92dc3461bbd..bb84e4d54a33 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c @@ -298,7 +298,7 @@ wndwc37e_new_(const struct nv50_wndw_func *func, struct nouveau_drm *drm, ret = nv50_dmac_create(&drm->client.device, &disp->disp->object, &oclass, 0, &args, sizeof(args), - disp->sync->bo.offset, &wndw->wndw); + disp->sync->offset, &wndw->wndw); if (ret) { NV_ERROR(drm, "qndw%04x allocation failed: %d\n", oclass, ret); return ret; diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index e2bae1424502..c32a8ca67f82 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c @@ -558,13 +558,13 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) if (drm->agp.bridge) { args.target = NV_DMA_V0_TARGET_AGP; args.access = NV_DMA_V0_ACCESS_RDWR; - args.start += drm->agp.base + chan->ntfy->bo.offset; - args.limit += drm->agp.base + chan->ntfy->bo.offset; + args.start += drm->agp.base + chan->ntfy->offset; + args.limit += drm->agp.base + chan->ntfy->offset; } else { args.target = NV_DMA_V0_TARGET_VM; args.access = NV_DMA_V0_ACCESS_RDWR; - args.start += chan->ntfy->bo.offset; - args.limit += chan->ntfy->bo.offset; + args.start += chan->ntfy->offset; + args.limit += chan->ntfy->offset; } client->route = NVDRM_OBJECT_ABI16; diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 2b4b21b02e40..b7a9b9e85355 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -1317,6 +1317,14 @@ nouveau_bo_move_ntfy(struct ttm_buffer_object *bo, bool evict, nouveau_vma_unmap(vma); } } + + if(new_reg) { + if (new_reg->mm_node) + nvbo->offset = (new_reg->start << PAGE_SHIFT); + else + nvbo->offset = 0; + } + } static int diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.h b/drivers/gpu/drm/nouveau/nouveau_bo.h index 38f9d8350963..e944b4aa5547 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.h +++ b/drivers/gpu/drm/nouveau/nouveau_bo.h @@ -24,6 +24,9 @@ struct nouveau_bo { int pbbo_index; bool validate_mapped; + /* GPU address space is independent of CPU word size */ + uint64_t offset; + struct list_head vma_list; unsigned contig:1; diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index d9381a053169..3d71dfcb2fde 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c @@ -162,7 +162,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device, * pushbuf lives in, this is because the GEM code requires that * we be able to call out to other (indirect) push buffers */ - chan->push.addr = chan->push.buffer->bo.offset; + chan->push.addr = chan->push.buffer->offset; if (device->info.family >= NV_DEVICE_INFO_V0_TESLA) { ret = nouveau_vma_new(chan->push.buffer, chan->vmm, diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c index 0ad5d87b5a8e..475ed53b99f1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c @@ -89,7 +89,7 @@ static unsigned long nouveau_dmem_page_addr(struct page *page) struct nouveau_dmem_chunk *chunk = page->zone_device_data; unsigned long idx = page_to_pfn(page) - chunk->pfn_first; - return (idx << PAGE_SHIFT) + chunk->bo->bo.offset; + return (idx << PAGE_SHIFT) + chunk->bo->offset; } static void nouveau_dmem_page_free(struct page *page) diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 0c5cdda3c336..508b118c0953 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -393,7 +393,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, /* To allow resizeing without swapping buffers */ NV_INFO(drm, "allocated %dx%d fb: 0x%llx, bo %p\n", - fb->base.width, fb->base.height, fb->nvbo->bo.offset, nvbo); + fb->base.width, fb->base.height, fb->nvbo->offset, nvbo); vga_switcheroo_client_fb_set(dev->pdev, info); return 0; diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index f5ece1f94973..cadff37eade8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -232,7 +232,7 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem, rep->domain = NOUVEAU_GEM_DOMAIN_GART; else rep->domain = NOUVEAU_GEM_DOMAIN_VRAM; - rep->offset = nvbo->bo.offset; + rep->offset = nvbo->offset; if (vmm->vmm.object.oclass >= NVIF_CLASS_VMM_NV50) { vma = nouveau_vma_find(nvbo, vmm); if (!vma) @@ -516,7 +516,7 @@ validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli, } if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) { - if (nvbo->bo.offset == b->presumed.offset && + if (nvbo->offset == b->presumed.offset && ((nvbo->bo.mem.mem_type == TTM_PL_VRAM && b->presumed.domain & NOUVEAU_GEM_DOMAIN_VRAM) || (nvbo->bo.mem.mem_type == TTM_PL_TT && @@ -527,7 +527,7 @@ validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli, b->presumed.domain = NOUVEAU_GEM_DOMAIN_GART; else b->presumed.domain = NOUVEAU_GEM_DOMAIN_VRAM; - b->presumed.offset = nvbo->bo.offset; + b->presumed.offset = nvbo->offset; b->presumed.valid = 0; relocs++; } @@ -805,7 +805,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, struct nouveau_bo *nvbo = (void *)(unsigned long) bo[push[i].bo_index].user_priv; - OUT_RING(chan, (nvbo->bo.offset + push[i].offset) | 2); + OUT_RING(chan, (nvbo->offset + push[i].offset) | 2); OUT_RING(chan, 0); } } else { @@ -840,7 +840,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, } OUT_RING(chan, 0x20000000 | - (nvbo->bo.offset + push[i].offset)); + (nvbo->offset + push[i].offset)); OUT_RING(chan, 0); for (j = 0; j < NOUVEAU_DMA_SKIPS; j++) OUT_RING(chan, 0); From patchwork Wed Feb 19 13:53:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11391801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9A50139A for ; Wed, 19 Feb 2020 16:18:41 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C4C102067D for ; Wed, 19 Feb 2020 16:18:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FDhB5dAD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4C102067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A30AA6EC4C; Wed, 19 Feb 2020 16:18:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 522F26EBF7; Wed, 19 Feb 2020 13:50:51 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id w15so637184wru.4; Wed, 19 Feb 2020 05:50:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n5R88FGnPjhsQadJtsU+Gi9+2LMayu3HLn44l5p9s88=; b=FDhB5dADnQpunlTNlf9946ku9SoWZXYYB2CeG8BOhSVd5ozLn2wLlmKkHn7TmGhrLy H3xKrxmVhew9ySyFu5cqVCV0Ft7fxr8yiw1mnfaFiuVHirV7+NuOjy8CIgQjZxBqGlQu 7Iz9FweJ+NZWPeuvZUMZCM/igpx4shxXyMH+qMyF3w2UWZxtg92+KdSR6TEd56zaC21w xKDAP4xu9Z5LHwmmWjZ+hm57Hkscgm6u/c4+Vwka0ytKeJtiBy3ACcTjY3/84hF6KW76 1Feqo2Soc0AmLFhZbSBLCIEKWePRLekTB0Cp7R90q1l81GKnY6M/A7lzmmhB2nYGpYTa 4ScQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n5R88FGnPjhsQadJtsU+Gi9+2LMayu3HLn44l5p9s88=; b=WvkgpxL6WnOPEQ0hZHaRKXyUxDzhj+lGMAdOnJa9gbE1MgS8wK/vRYWHVdiSypmEcx jDvKXq3om6xs0HsPB3+aozPQuy6C5rDkLlW6mcJV2r+x0/Wa48VlIGv/kC9eDlJxNpaz 1jZdV85olRqiZ9eF+dpn7IbzUwv+G+d6HQKYEtSwjbn2I2ejjHTwmSdTx5daQ+GIxYZT WRIFgbyGsQWY0qFMOYqX1L6XjVcM00/NvTl0ngbhLy27JX4mp0Sjgug2pukAAhRMqZCM fOIYF7C5keeivGfh2Y8617FbnX94PDVG2LtpULW72PfP5NkP7InRFhF5QTb6gXtpgkuR ALMQ== X-Gm-Message-State: APjAAAX6s8/pSACXEsTNhgy3SYBBnIF8g8WO1rsSE5lun2Cm16pkW9QK iaqpN4Fl1X7DRmrBqEEbZXy2PjaRPVT/rA== X-Google-Smtp-Source: APXvYqx67oTjjObdvaY3VYuFUBZ3SmHOv889hszmN5z478qhFvSt+0EIh8Ev/Vd0Y5pgdZQ5/MQuAA== X-Received: by 2002:a5d:6789:: with SMTP id v9mr38091600wru.55.1582120249549; Wed, 19 Feb 2020 05:50:49 -0800 (PST) Received: from brihaspati.fritz.box (p5DE53754.dip0.t-ipconnect.de. [93.229.55.84]) by smtp.gmail.com with ESMTPSA id y1sm3061881wrq.16.2020.02.19.05.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 05:50:48 -0800 (PST) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 5/8] drm/qxl: don't use ttm bo->offset Date: Wed, 19 Feb 2020 14:53:19 +0100 Message-Id: <20200219135322.56463-6-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200219135322.56463-1-nirmoy.das@amd.com> References: <20200219135322.56463-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Feb 2020 16:18:11 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, amd-gfx@lists.freedesktop.org, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This patch removes slot->gpu_offset which is not required as VRAM and PRIV slot are in separate PCI bar This patch also removes unused qxl_bo_gpu_offset() Signed-off-by: Nirmoy Das Acked-by: Christian König Acked-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_drv.h | 6 ++---- drivers/gpu/drm/qxl/qxl_kms.c | 5 ++--- drivers/gpu/drm/qxl/qxl_object.h | 5 ----- drivers/gpu/drm/qxl/qxl_ttm.c | 9 --------- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 27e45a2d6b52..df581f0e6699 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -134,7 +134,6 @@ struct qxl_memslot { uint64_t start_phys_addr; uint64_t size; uint64_t high_bits; - uint64_t gpu_offset; }; enum { @@ -311,10 +310,9 @@ qxl_bo_physical_address(struct qxl_device *qdev, struct qxl_bo *bo, (bo->tbo.mem.mem_type == TTM_PL_VRAM) ? &qdev->main_slot : &qdev->surfaces_slot; - WARN_ON_ONCE((bo->tbo.offset & slot->gpu_offset) != slot->gpu_offset); + /* TODO - need to hold one of the locks to read bo->tbo.mem.start */ - /* TODO - need to hold one of the locks to read tbo.offset */ - return slot->high_bits | (bo->tbo.offset - slot->gpu_offset + offset); + return slot->high_bits | ((bo->tbo.mem.start << PAGE_SHIFT) + offset); } /* qxl_display.c */ diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c index 70b20ee4741a..7a5bf544f34d 100644 --- a/drivers/gpu/drm/qxl/qxl_kms.c +++ b/drivers/gpu/drm/qxl/qxl_kms.c @@ -86,11 +86,10 @@ static void setup_slot(struct qxl_device *qdev, high_bits <<= (64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits)); slot->high_bits = high_bits; - DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx, gpu_offset 0x%lx\n", + DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx\n", slot->index, slot->name, (unsigned long)slot->start_phys_addr, - (unsigned long)slot->size, - (unsigned long)slot->gpu_offset); + (unsigned long)slot->size); } void qxl_reinit_memslots(struct qxl_device *qdev) diff --git a/drivers/gpu/drm/qxl/qxl_object.h b/drivers/gpu/drm/qxl/qxl_object.h index 8ae54ba7857c..21fa81048f4f 100644 --- a/drivers/gpu/drm/qxl/qxl_object.h +++ b/drivers/gpu/drm/qxl/qxl_object.h @@ -48,11 +48,6 @@ static inline void qxl_bo_unreserve(struct qxl_bo *bo) ttm_bo_unreserve(&bo->tbo); } -static inline u64 qxl_bo_gpu_offset(struct qxl_bo *bo) -{ - return bo->tbo.offset; -} - static inline unsigned long qxl_bo_size(struct qxl_bo *bo) { return bo->tbo.num_pages << PAGE_SHIFT; diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index 62a5e424971b..635d000e7934 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c @@ -51,11 +51,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev) static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, struct ttm_mem_type_manager *man) { - struct qxl_device *qdev = qxl_get_qdev(bdev); - unsigned int gpu_offset_shift = - 64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits + 8); - struct qxl_memslot *slot; - switch (type) { case TTM_PL_SYSTEM: /* System memory */ @@ -66,11 +61,7 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, case TTM_PL_VRAM: case TTM_PL_PRIV: /* "On-card" video ram */ - slot = (type == TTM_PL_VRAM) ? - &qdev->main_slot : &qdev->surfaces_slot; - slot->gpu_offset = (uint64_t)type << gpu_offset_shift; man->func = &ttm_bo_manager_func; - man->gpu_offset = slot->gpu_offset; man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; man->available_caching = TTM_PL_MASK_CACHING; From patchwork Wed Feb 19 13:53:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11391781 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF4DA13A4 for ; Wed, 19 Feb 2020 16:18:25 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9DC3B2464E for ; Wed, 19 Feb 2020 16:18:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VhH50M4m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DC3B2464E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 18D1C89DA4; Wed, 19 Feb 2020 16:18:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9953A6EBF8; Wed, 19 Feb 2020 13:50:52 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id a5so739628wmb.0; Wed, 19 Feb 2020 05:50:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AolbXk2Fq1YBeMjbbUIDV5EfiVXR8mlZoIKExVmKJBk=; b=VhH50M4meNxnkB1EPYKHUpA1IM9ih8BDfO2AM94Wx2tcQM0illVMIgAUXsBkSdNiKV xXbruD5QQtFxs4fHEj5jRWO5IOq8DYKQEATgJDZpeP0QHo0yKEquEvRq4I1C9PttdkBg l5LljPhnCsVgZIZPmGir1xERNUgC92PXL8kS0O0efm4UZHL/2RJBe5E9b4s8kMpUkT13 57bdWyTugNChFxEfYcbmeY+PoJh3m9elYnBdK4EjIefuJKF/PTJsdQUhebFRff5HSe8l 3locYDa9GTCSa0t3dFqBnppe1HstAE5/b6wcMp0VD6L/b1bhkn+NcP8/0MlPSmCUzQIG TErw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AolbXk2Fq1YBeMjbbUIDV5EfiVXR8mlZoIKExVmKJBk=; b=bNcJpSpRAZvMyRTyDSdC3vSnO0AfQk1nDq4XaTCNZd4eiS7Cj1g27GWI4v6Cn1qZzv XbFKt42EJZxrSbca4+V85z1Pn+IMBCXNewp7cTHpIDP9uoa4qbE4Lb7D9XHDh+PLeEaG ZakfkwKQcMWmakz3b7ptOCo3m+H5gzABZ6jix9nZeYr92GlqhNu4cl+qt9Zwi2JMdJAi Jd8qCvwDqCfamSb9hkj7ryKx24J+rYbR9hWtMktHPwrAPn/a9SXVbTUtMBGumjty0frH z+uE/NuEDrwAeTtHVa+tOHjVKMUr9c+7mQp1SPGynrf0NkU15fnbYjafyZtVOTmzsRfy /kmQ== X-Gm-Message-State: APjAAAV7+u4btvA4lejhDI7pAxdQ7PH8YT+28dZJuTiiPMYzw4jed6UZ 80lFxDeMxrr6v3YXUfG456qtJuLYwGUQRA== X-Google-Smtp-Source: APXvYqxH2Xap7PnOtG3CBUOE+VMnOjDBlPdPBYuTKs2p0y6Gqu6uGyG96jtLtIjZQWqf6787jsSpyg== X-Received: by 2002:a1c:1fc5:: with SMTP id f188mr10651308wmf.55.1582120250856; Wed, 19 Feb 2020 05:50:50 -0800 (PST) Received: from brihaspati.fritz.box (p5DE53754.dip0.t-ipconnect.de. [93.229.55.84]) by smtp.gmail.com with ESMTPSA id y1sm3061881wrq.16.2020.02.19.05.50.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 05:50:50 -0800 (PST) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 6/8] drm/vram-helper: don't use ttm bo->offset v2 Date: Wed, 19 Feb 2020 14:53:20 +0100 Message-Id: <20200219135322.56463-7-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200219135322.56463-1-nirmoy.das@amd.com> References: <20200219135322.56463-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Feb 2020 16:18:11 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, amd-gfx@lists.freedesktop.org, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Calculate GEM VRAM bo's offset within vram-helper without depending on bo->offset Signed-off-by: Nirmoy Das Reviewed-by: Daniel Vetter Reviewed-by: Thomas Zimmermann --- drivers/gpu/drm/drm_gem_vram_helper.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) -- 2.25.0 diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c index 92a11bb42365..3edf5f241c15 100644 --- a/drivers/gpu/drm/drm_gem_vram_helper.c +++ b/drivers/gpu/drm/drm_gem_vram_helper.c @@ -198,6 +198,21 @@ u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo) } EXPORT_SYMBOL(drm_gem_vram_mmap_offset); +/** + * drm_gem_vram_pg_offset() - Returns a GEM VRAM object's page offset + * @gbo: the GEM VRAM object + * + * Returns: + * The buffer object's page offset, or + * 0 with a warning when memory manager node of the buffer object is NULL + * */ +static s64 drm_gem_vram_pg_offset(struct drm_gem_vram_object *gbo) +{ + if (WARN_ON_ONCE(!gbo->bo.mem.mm_node)) + return 0; + return gbo->bo.mem.start; +} + /** * drm_gem_vram_offset() - \ Returns a GEM VRAM object's offset in video memory @@ -214,7 +229,7 @@ s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo) { if (WARN_ON_ONCE(!gbo->pin_count)) return (s64)-ENODEV; - return gbo->bo.offset; + return drm_gem_vram_pg_offset(gbo) << PAGE_SHIFT; } EXPORT_SYMBOL(drm_gem_vram_offset); From patchwork Wed Feb 19 13:53:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11391789 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B68EE139A for ; Wed, 19 Feb 2020 16:18:33 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 94B132067D for ; Wed, 19 Feb 2020 16:18:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m/Me70o0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94B132067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 156CC6EC47; Wed, 19 Feb 2020 16:18:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7AF33893EA; Wed, 19 Feb 2020 13:50:54 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id t23so735705wmi.1; Wed, 19 Feb 2020 05:50:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JAxgNVMs+kqprjwWCPzpoZ2SvD2juEYl06fjrgdXxKc=; b=m/Me70o0UM66u0UgY/fm83Y0jPS+JX/e7pKtjWhfrZf9ey+LtKiWXW4srkYJNcwg9H Qv4IHEvRB3ly/lRHJ8dz86jVbqfRsRoiPvCl3ms33qMKZdHvev2QDtsLF4yOvGV4RF6h Gip6ZljzOtlHFhZWvZwriBKvhPR8ankNvtDe/19ClIOM2RU9Nf3VP7doON4T9WTvdAHx 9H/vXGikxSnQyGp5KxeWNPoanTp97UppC367Vkhp46QXZSsLxCp9Xp5puLBkGVOnfAae jysBseirMilMzg6VrfnmWqN+6afFALXzCSERuYbM9J9vwxt+gkO+viEZIstdLdNP1Icd IkyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JAxgNVMs+kqprjwWCPzpoZ2SvD2juEYl06fjrgdXxKc=; b=F0Wfy1CC5H7e0FnoWH4IkAgfumeRvsnitBhTqQXvbKUoCmXMMdFZ8h6ZyKtoWLHSjz A7ePaKUG8OituhwXZaXCj6AtOtpJF2VbWRvEio6VZpTp0howYtM/g5ymiNhK38ZPTstO fYY8rwMdHt8tZRyOmlP32M5hB4Qf821Eu99azGutZ8/5cWQCFSuudYvtMZfmpzbFyyUi rjYa2OaG836qTWYYWTNqBiWpST5VJokM4XuIkZmeymT0ALl0sM/fEIEhBqe9H6Chrrhd wST/g3m0fifEBdTjbnl8PebyOvrOnqj0cpOfdp36DHcC02TxOnFB6PnVbELLO5Q16dG8 2opg== X-Gm-Message-State: APjAAAULhFL3ZkC3e4GOOveq8I4gGq3fW15C9EIOKWKeX/SoxaO0F8mR kytyDvBJ2GExlFI4zmPZ2k1cBhsPxINDAg== X-Google-Smtp-Source: APXvYqzkBhzxuAntsMEoWQsylI5pZMxyufrOsGJ57gDo5SYSX3dUN82M8BNnI0VHD3pmw+pBvFoLZA== X-Received: by 2002:a05:600c:248:: with SMTP id 8mr10247517wmj.1.1582120252762; Wed, 19 Feb 2020 05:50:52 -0800 (PST) Received: from brihaspati.fritz.box (p5DE53754.dip0.t-ipconnect.de. [93.229.55.84]) by smtp.gmail.com with ESMTPSA id y1sm3061881wrq.16.2020.02.19.05.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 05:50:52 -0800 (PST) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 7/8] drm/bochs: use drm_gem_vram_offset to get bo offset v2 Date: Wed, 19 Feb 2020 14:53:21 +0100 Message-Id: <20200219135322.56463-8-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200219135322.56463-1-nirmoy.das@amd.com> References: <20200219135322.56463-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Feb 2020 16:18:11 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, amd-gfx@lists.freedesktop.org, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Switch over to GEM VRAM's implementation to retrieve bo->offset Signed-off-by: Nirmoy Das Reviewed-by: Daniel Vetter --- drivers/gpu/drm/bochs/bochs_kms.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.25.0 diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c index 8066d7d370d5..18d2ec34534d 100644 --- a/drivers/gpu/drm/bochs/bochs_kms.c +++ b/drivers/gpu/drm/bochs/bochs_kms.c @@ -29,16 +29,21 @@ static void bochs_plane_update(struct bochs_device *bochs, struct drm_plane_state *state) { struct drm_gem_vram_object *gbo; + s64 gpu_addr; if (!state->fb || !bochs->stride) return; gbo = drm_gem_vram_of_gem(state->fb->obj[0]); + gpu_addr = drm_gem_vram_offset(gbo); + if (WARN_ON_ONCE(gpu_addr < 0)) + return; /* Bug: we didn't pin the BO to VRAM in prepare_fb. */ + bochs_hw_setbase(bochs, state->crtc_x, state->crtc_y, state->fb->pitches[0], - state->fb->offsets[0] + gbo->bo.offset); + state->fb->offsets[0] + gpu_addr); bochs_hw_setformat(bochs, state->fb->format); } From patchwork Wed Feb 19 13:53:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11391793 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD28213A4 for ; Wed, 19 Feb 2020 16:18:39 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AB5662067D for ; Wed, 19 Feb 2020 16:18:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K6PePbxr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB5662067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0964B6EC4E; Wed, 19 Feb 2020 16:18:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 995906EBF9; Wed, 19 Feb 2020 13:50:56 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id c9so606291wrw.8; Wed, 19 Feb 2020 05:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1BQ3RLCCPj8Vx5ymm6Uw4hsRHsW/TZRnV/QBxLYgzPE=; b=K6PePbxrFjWbY03tih5qY6w88t4RI3CnQQWh6Bpio3HdR0POP9J1PZwyjxERD+zJYR hA6Sh9ajIlAQpUpY1raNQDzxFaGKgPMol5Hd7FfSynBF9D1VR0hYvCaXqyj6+Co83FUG GK+GLQE0ywdD7xOvU/hNI2rFI6N6MR6ymHHtJsPnRibK0NKrZSzerUHihyXpnpPKTIwf GeBx6uWr71leEaZ0336KWakBAfABTSnAhtebLX9oOu4hbkxYdBvsdQLV0CJNT2wIYIhp bHLp2qNqKghZLZ5dEhGUO+jJ9ZMF6ax55UAuknqZUi3zbn33yAVy4+MwiAz4U0XmP/qP DEVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1BQ3RLCCPj8Vx5ymm6Uw4hsRHsW/TZRnV/QBxLYgzPE=; b=dawViytkcb18ZE5LG6pxWeipdeRicZw1xBBZTZaGApNEWQduldtVIrLTNHke0pZazD +lP1IaumNSPuPJ94LS1uF1SwHJFKdEPZi4z1dKnw3XzNAsuaDgA45FoTQbY00bI4kbiv UKW+Uu7ilo+7kgCMJdSe3agQ9heWyGg08zel/EouJzLFjKWK67bMOCUbb1rnn6SpFKTI P2zI5w0KhXJqIHZewj7xJFrdsVxZ1JkBnpCgbwf2Wq4xbScVJ0fphm3ERhkldqVXNKzb vzIfSCK3JGOTBjeqH+T0TBBEuc1JIvITVG53uTYokug3ZaeprPgHI1RwMnKta8k0+9gP 0g2Q== X-Gm-Message-State: APjAAAXiKajpckRbIFDByyV15mGbRQxmd3JBNK/VVRI4WqV3KrILjvc0 PwcuIgEhD3V5sJAWTkHkX+ye9UdAgpTX4g== X-Google-Smtp-Source: APXvYqwrxRMqCWIUMRToOvWkusgU3QGsOnPV/TQM3PpZjWapGBRqrbuZrAhmeWchZZTsO0FLN3aAhw== X-Received: by 2002:adf:fa86:: with SMTP id h6mr35535578wrr.418.1582120254836; Wed, 19 Feb 2020 05:50:54 -0800 (PST) Received: from brihaspati.fritz.box (p5DE53754.dip0.t-ipconnect.de. [93.229.55.84]) by smtp.gmail.com with ESMTPSA id y1sm3061881wrq.16.2020.02.19.05.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 05:50:54 -0800 (PST) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 8/8] drm/ttm: do not keep GPU dependent addresses Date: Wed, 19 Feb 2020 14:53:22 +0100 Message-Id: <20200219135322.56463-9-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200219135322.56463-1-nirmoy.das@amd.com> References: <20200219135322.56463-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Feb 2020 16:18:11 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, amd-gfx@lists.freedesktop.org, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" GPU address handling is device specific and should be handle by its device driver. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/ttm/ttm_bo.c | 7 ------- include/drm/ttm/ttm_bo_api.h | 2 -- include/drm/ttm/ttm_bo_driver.h | 1 - 3 files changed, 10 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 151edfd8de77..d5885cd609a3 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -85,7 +85,6 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *p drm_printf(p, " has_type: %d\n", man->has_type); drm_printf(p, " use_type: %d\n", man->use_type); drm_printf(p, " flags: 0x%08X\n", man->flags); - drm_printf(p, " gpu_offset: 0x%08llX\n", man->gpu_offset); drm_printf(p, " size: %llu\n", man->size); drm_printf(p, " available_caching: 0x%08X\n", man->available_caching); drm_printf(p, " default_caching: 0x%08X\n", man->default_caching); @@ -345,12 +344,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, moved: bo->evicted = false; - if (bo->mem.mm_node) - bo->offset = (bo->mem.start << PAGE_SHIFT) + - bdev->man[bo->mem.mem_type].gpu_offset; - else - bo->offset = 0; - ctx->bytes_moved += bo->num_pages << PAGE_SHIFT; return 0; diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index b9bc1b00142e..d6f39ee5bf5d 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -213,8 +213,6 @@ struct ttm_buffer_object { * either of these locks held. */ - uint64_t offset; /* GPU address space is independent of CPU word size */ - struct sg_table *sg; }; diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index c9e0fd09f4b2..c8ce6c181abe 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -177,7 +177,6 @@ struct ttm_mem_type_manager { bool has_type; bool use_type; uint32_t flags; - uint64_t gpu_offset; /* GPU address space is independent of CPU word size */ uint64_t size; uint32_t available_caching; uint32_t default_caching;