From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 08/10] drm/amdgpu: distinct between allocated GART space and GMC addr
Date: Tue, 28 Aug 2018 10:16:07 +0800 [thread overview]
Message-ID: <5B84B067.1060407@amd.com> (raw)
In-Reply-To: <20180827165337.1651-8-christian.koenig-5C7GfCeVMHo@public.gmane.org>
On 08/28/2018 12:53 AM, Christian König wrote:
> Most of the time we only need to know if the BO has a valid GMC addr.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
good to see this cleanup :)
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 --
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 +++++--------
> 3 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 5ddd4e87480b..b5f20b42439e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -1362,8 +1362,6 @@ void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
> u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)
> {
> WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_SYSTEM);
> - WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_TT &&
> - !amdgpu_gtt_mgr_has_gart_addr(&bo->tbo.mem));
> WARN_ON_ONCE(!ww_mutex_is_locked(&bo->tbo.resv->lock) &&
> !bo->pin_count);
> WARN_ON_ONCE(bo->tbo.mem.start == AMDGPU_BO_INVALID_OFFSET);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index 18945dd6982d..37c79ae3574e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -200,7 +200,7 @@ static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo)
> static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo)
> {
> switch (bo->tbo.mem.mem_type) {
> - case TTM_PL_TT: return amdgpu_gtt_mgr_has_gart_addr(&bo->tbo.mem);
> + case TTM_PL_TT: return bo->tbo.mem.start != AMDGPU_BO_INVALID_OFFSET;
> case TTM_PL_VRAM: return true;
> default: return false;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 5cadf4f1ee2c..d9f3201c9e5c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -345,7 +345,7 @@ static uint64_t amdgpu_mm_node_addr(struct ttm_buffer_object *bo,
> {
> uint64_t addr = 0;
>
> - if (mem->mem_type != TTM_PL_TT || amdgpu_gtt_mgr_has_gart_addr(mem)) {
> + if (mm_node->start != AMDGPU_BO_INVALID_OFFSET) {
> addr = mm_node->start << PAGE_SHIFT;
> addr += bo->bdev->man[mem->mem_type].gpu_offset;
> }
> @@ -433,8 +433,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
> /* Map only what needs to be accessed. Map src to window 0 and
> * dst to window 1
> */
> - if (src->mem->mem_type == TTM_PL_TT &&
> - !amdgpu_gtt_mgr_has_gart_addr(src->mem)) {
> + if (src->mem->start == AMDGPU_BO_INVALID_OFFSET) {
> r = amdgpu_map_buffer(src->bo, src->mem,
> PFN_UP(cur_size + src_page_offset),
> src_node_start, 0, ring,
> @@ -447,8 +446,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
> from += src_page_offset;
> }
>
> - if (dst->mem->mem_type == TTM_PL_TT &&
> - !amdgpu_gtt_mgr_has_gart_addr(dst->mem)) {
> + if (dst->mem->start == AMDGPU_BO_INVALID_OFFSET) {
> r = amdgpu_map_buffer(dst->bo, dst->mem,
> PFN_UP(cur_size + dst_page_offset),
> dst_node_start, 1, ring,
> @@ -1086,11 +1084,10 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo)
> uint64_t flags;
> int r;
>
> - if (bo->mem.mem_type != TTM_PL_TT ||
> - amdgpu_gtt_mgr_has_gart_addr(&bo->mem))
> + if (bo->mem.start != AMDGPU_BO_INVALID_OFFSET)
> return 0;
>
> - /* allocate GTT space */
> + /* allocate GART space */
> tmp = bo->mem;
> tmp.mm_node = NULL;
> placement.num_placement = 1;
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2018-08-28 2:16 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-27 16:53 [PATCH 01/10] drm/amdgpu: use only the lower address space on GMC9 Christian König
[not found] ` <20180827165337.1651-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-27 16:53 ` [PATCH 02/10] drm/amdgpu: move amdgpu_device_(vram|gtt)_location Christian König
[not found] ` <20180827165337.1651-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-27 18:59 ` Alex Deucher
[not found] ` <CADnq5_OPp_EgorzVizo4LpcdJj38daZbRrF0aSRg8emouKLzEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-28 1:56 ` Zhang, Jerry (Junwei)
2018-08-27 16:53 ` [PATCH 03/10] drm/amdgpu: fix amdgpu_gmc_gart_location a little bit Christian König
[not found] ` <20180827165337.1651-3-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-27 19:03 ` Alex Deucher
[not found] ` <CADnq5_OmwbjRufiL30T9EZOrhu4suRDy417xSy=BfdGmb94XJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-29 9:45 ` Christian König
2018-08-28 1:57 ` Zhang, Jerry (Junwei)
2018-08-27 16:53 ` [PATCH 04/10] drm/amdgpu: use the smaller hole for GART Christian König
[not found] ` <20180827165337.1651-4-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-27 19:05 ` Alex Deucher
[not found] ` <CADnq5_OB2HV16p4_idyqowKDTZxZkJF5GmKGnHG5+DPm2=4qEQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-28 1:57 ` Zhang, Jerry (Junwei)
2018-08-27 16:53 ` [PATCH 05/10] drm/amdgpu: put GART away from VRAM Christian König
[not found] ` <20180827165337.1651-5-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-28 2:01 ` Zhang, Jerry (Junwei)
2018-08-27 16:53 ` [PATCH 06/10] drm/amdgpu: add amdgpu_gmc_agp_location Christian König
[not found] ` <20180827165337.1651-6-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-27 18:50 ` Felix Kuehling
[not found] ` <995a274e-8478-79ac-bed3-61fe6655a393-5C7GfCeVMHo@public.gmane.org>
2018-08-28 11:57 ` Christian König
2018-08-28 2:35 ` Zhang, Jerry (Junwei)
2018-08-27 16:53 ` [PATCH 07/10] drm/amdgpu: stop using gart_start as offset for the GTT domain Christian König
[not found] ` <20180827165337.1651-7-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-27 19:07 ` Alex Deucher
[not found] ` <CADnq5_M-ppsYV3dsUZEeHaLKyVOkVU1LsWJyyyWve0_eMD-7qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-28 2:10 ` Zhang, Jerry (Junwei)
2018-08-27 16:53 ` [PATCH 08/10] drm/amdgpu: distinct between allocated GART space and GMC addr Christian König
[not found] ` <20180827165337.1651-8-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-27 18:57 ` Felix Kuehling
2018-08-28 2:16 ` Zhang, Jerry (Junwei) [this message]
2018-08-27 16:53 ` [PATCH 09/10] drm/amdgpu: use the AGP aperture for system memory access Christian König
[not found] ` <20180827165337.1651-9-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-28 2:50 ` Zhang, Jerry (Junwei)
2018-08-27 16:53 ` [PATCH 10/10] drm/amdgpu: enable AGP aperture for GMC9 Christian König
[not found] ` <20180827165337.1651-10-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-28 2:52 ` Zhang, Jerry (Junwei)
[not found] ` <5B84B901.5010709-5C7GfCeVMHo@public.gmane.org>
2018-08-28 11:55 ` Christian König
2018-08-27 18:58 ` [PATCH 01/10] drm/amdgpu: use only the lower address space on GMC9 Alex Deucher
2018-08-27 19:03 ` Felix Kuehling
[not found] ` <e5ef79ee-caef-9df4-aadc-bbd15b5eb9b3-5C7GfCeVMHo@public.gmane.org>
2018-08-28 4:21 ` zhoucm1
[not found] ` <75818784-27b6-21bc-274f-f29b0dd479e0-5C7GfCeVMHo@public.gmane.org>
2018-08-28 6:53 ` Christian König
[not found] ` <e21d83cd-fee8-fd99-ac02-39b5f29df92e-5C7GfCeVMHo@public.gmane.org>
2018-08-28 18:08 ` Felix Kuehling
2018-08-28 5:31 ` Xiao, Jack
[not found] ` <BYAPR12MB2662148F853F560ED08FDBCFEF0A0-ZGDeBxoHBPm6habpV69vmAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-08-28 6:45 ` Christian König
[not found] ` <5812c9d9-00bb-9065-fefe-49d661ab9439-5C7GfCeVMHo@public.gmane.org>
2018-08-28 7:06 ` Xiao, Jack
[not found] ` <DM6PR12MB2666F87E35885284AB6B29A7EF0A0-lmeGfMZKVrEbyIpG/Z/xuAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-08-28 11:41 ` Christian König
[not found] ` <b845f750-d6a7-c8ae-5235-7d961a3db428-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-28 18:12 ` Felix Kuehling
[not found] ` <491b519e-6f02-1c4c-3cc8-c0ed147a82cd-5C7GfCeVMHo@public.gmane.org>
2018-08-29 8:47 ` Christian König
[not found] ` <a2680c89-493a-2df8-f767-5d0f25e9f7ef-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-30 3:48 ` Xiao, Jack
[not found] ` <BYAPR12MB2662C7816E74F1C90E2E73BAEF080-ZGDeBxoHBPm6habpV69vmAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-08-30 6:40 ` Christian König
2018-08-29 6:30 ` Xiao, Jack
2018-08-28 1:56 ` Zhang, Jerry (Junwei)
[not found] ` <5B84ABBC.40005-5C7GfCeVMHo@public.gmane.org>
2018-08-28 2:09 ` Zhang, Jerry (Junwei)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5B84B067.1060407@amd.com \
--to=jerry.zhang-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox