From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Alex Deucher"
<alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"Christian König"
<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: amd-gfx list <amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 02/10] drm/amdgpu: move amdgpu_device_(vram|gtt)_location
Date: Tue, 28 Aug 2018 09:56:39 +0800 [thread overview]
Message-ID: <5B84ABD7.4030706@amd.com> (raw)
In-Reply-To: <CADnq5_OPp_EgorzVizo4LpcdJj38daZbRrF0aSRg8emouKLzEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On 08/28/2018 02:59 AM, Alex Deucher wrote:
> On Mon, Aug 27, 2018 at 12:56 PM Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
>>
>> Move that into amdgpu_gmc.c since we are really deadling with GMC
>> address space here.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 --
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 65 ----------------------
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 64 +++++++++++++++++++++
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 4 ++
>> drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 4 +-
>> drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 4 +-
>> drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 4 +-
>> drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 4 +-
>> 8 files changed, 76 insertions(+), 77 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index 340e40d03d54..09bdedfc91c7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -1166,10 +1166,6 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev);
>>
>> void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
>> u64 num_vis_bytes);
>> -void amdgpu_device_vram_location(struct amdgpu_device *adev,
>> - struct amdgpu_gmc *mc, u64 base);
>> -void amdgpu_device_gart_location(struct amdgpu_device *adev,
>> - struct amdgpu_gmc *mc);
>> int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev);
>> void amdgpu_device_program_register_sequence(struct amdgpu_device *adev,
>> const u32 *registers,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 9f5e4be76d5e..0afc5e599683 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -651,71 +651,6 @@ void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb)
>> __clear_bit(wb, adev->wb.used);
>> }
>>
>> -/**
>> - * amdgpu_device_vram_location - try to find VRAM location
>> - *
>> - * @adev: amdgpu device structure holding all necessary informations
>> - * @mc: memory controller structure holding memory informations
>> - * @base: base address at which to put VRAM
>> - *
>> - * Function will try to place VRAM at base address provided
>> - * as parameter.
>> - */
>> -void amdgpu_device_vram_location(struct amdgpu_device *adev,
>> - struct amdgpu_gmc *mc, u64 base)
>> -{
>> - uint64_t limit = (uint64_t)amdgpu_vram_limit << 20;
>> -
>> - mc->vram_start = base;
>> - mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
>> - if (limit && limit < mc->real_vram_size)
>> - mc->real_vram_size = limit;
>> - dev_info(adev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n",
>> - mc->mc_vram_size >> 20, mc->vram_start,
>> - mc->vram_end, mc->real_vram_size >> 20);
>> -}
>> -
>> -/**
>> - * amdgpu_device_gart_location - try to find GART location
>> - *
>> - * @adev: amdgpu device structure holding all necessary informations
>> - * @mc: memory controller structure holding memory informations
>> - *
>> - * Function will place try to place GART before or after VRAM.
>> - *
>> - * If GART size is bigger than space left then we ajust GART size.
>> - * Thus function will never fails.
>> - */
>> -void amdgpu_device_gart_location(struct amdgpu_device *adev,
>> - struct amdgpu_gmc *mc)
>> -{
>> - u64 size_af, size_bf;
>> -
>> - mc->gart_size += adev->pm.smu_prv_buffer_size;
>> -
>> - size_af = adev->gmc.mc_mask - mc->vram_end;
>> - size_bf = mc->vram_start;
>> - if (size_bf > size_af) {
>> - if (mc->gart_size > size_bf) {
>> - dev_warn(adev->dev, "limiting GART\n");
>> - mc->gart_size = size_bf;
>> - }
>> - mc->gart_start = 0;
>> - } else {
>> - if (mc->gart_size > size_af) {
>> - dev_warn(adev->dev, "limiting GART\n");
>> - mc->gart_size = size_af;
>> - }
>> - /* VCE doesn't like it when BOs cross a 4GB segment, so align
>> - * the GART base on a 4GB boundary as well.
>> - */
>> - mc->gart_start = ALIGN(mc->vram_end + 1, 0x100000000ULL);
>> - }
>> - mc->gart_end = mc->gart_start + mc->gart_size - 1;
>> - dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n",
>> - mc->gart_size >> 20, mc->gart_start, mc->gart_end);
>> -}
>> -
>> /**
>> * amdgpu_device_resize_fb_bar - try to resize FB BAR
>> *
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
>> index a249931ef512..72dffa3fd194 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
>> @@ -78,3 +78,67 @@ uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo)
>> }
>> return pd_addr;
>> }
>> +
>> +/**
>> + * amdgpu_gmc_vram_location - try to find VRAM location
>> + *
>> + * @adev: amdgpu device structure holding all necessary informations
>> + * @mc: memory controller structure holding memory informations
>> + * @base: base address at which to put VRAM
>> + *
>> + * Function will try to place VRAM at base address provided
>> + * as parameter.
>> + */
>> +void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc,
>> + u64 base)
>> +{
>> + uint64_t limit = (uint64_t)amdgpu_vram_limit << 20;
>> +
>> + mc->vram_start = base;
>> + mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
>> + if (limit && limit < mc->real_vram_size)
>> + mc->real_vram_size = limit;
>> + dev_info(adev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n",
>> + mc->mc_vram_size >> 20, mc->vram_start,
>> + mc->vram_end, mc->real_vram_size >> 20);
>> +}
>> +
>> +/**
>> + * amdgpu_gmc_gart_location - try to find GART location
>> + *
>> + * @adev: amdgpu device structure holding all necessary informations
>> + * @mc: memory controller structure holding memory informations
>> + *
>> + * Function will place try to place GART before or after VRAM.
>> + *
>> + * If GART size is bigger than space left then we ajust GART size.
>> + * Thus function will never fails.
>> + */
>> +void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
>> +{
>> + u64 size_af, size_bf;
>> +
>> + mc->gart_size += adev->pm.smu_prv_buffer_size;
>> +
>> + size_af = adev->gmc.mc_mask - mc->vram_end;
>> + size_bf = mc->vram_start;
>> + if (size_bf > size_af) {
>> + if (mc->gart_size > size_bf) {
>> + dev_warn(adev->dev, "limiting GART\n");
>> + mc->gart_size = size_bf;
>> + }
>> + mc->gart_start = 0;
>> + } else {
>> + if (mc->gart_size > size_af) {
>> + dev_warn(adev->dev, "limiting GART\n");
>> + mc->gart_size = size_af;
>> + }
>> + /* VCE doesn't like it when BOs cross a 4GB segment, so align
>> + * the GART base on a 4GB boundary as well.
>> + */
>> + mc->gart_start = ALIGN(mc->vram_end + 1, 0x100000000ULL);
>> + }
>> + mc->gart_end = mc->gart_start + mc->gart_size - 1;
>> + dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n",
>> + mc->gart_size >> 20, mc->gart_start, mc->gart_end);
>> +}
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
>> index 0d2c9f65ca13..72fcc9338f5e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
>> @@ -134,5 +134,9 @@ static inline bool amdgpu_gmc_vram_full_visible(struct amdgpu_gmc *gmc)
>> void amdgpu_gmc_get_pde_for_bo(struct amdgpu_bo *bo, int level,
>> uint64_t *addr, uint64_t *flags);
>> uint64_t amdgpu_gmc_pd_addr(struct amdgpu_bo *bo);
>> +void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc,
>> + u64 base);
>> +void amdgpu_gmc_gart_location(struct amdgpu_device *adev,
>> + struct amdgpu_gmc *mc);
>>
>> #endif
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
>> index 543287e5d67b..c2866e1acbef 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
>> @@ -224,8 +224,8 @@ static void gmc_v6_0_vram_gtt_location(struct amdgpu_device *adev,
>> u64 base = RREG32(mmMC_VM_FB_LOCATION) & 0xFFFF;
>> base <<= 24;
>>
>> - amdgpu_device_vram_location(adev, &adev->gmc, base);
>> - amdgpu_device_gart_location(adev, mc);
>> + amdgpu_gmc_vram_location(adev, &adev->gmc, base);
>> + amdgpu_gmc_gart_location(adev, mc);
>> }
>>
>> static void gmc_v6_0_mc_program(struct amdgpu_device *adev)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>> index 060c79afef80..cbbbb6bbf782 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>> @@ -244,8 +244,8 @@ static void gmc_v7_0_vram_gtt_location(struct amdgpu_device *adev,
>> u64 base = RREG32(mmMC_VM_FB_LOCATION) & 0xFFFF;
>> base <<= 24;
>>
>> - amdgpu_device_vram_location(adev, &adev->gmc, base);
>> - amdgpu_device_gart_location(adev, mc);
>> + amdgpu_gmc_vram_location(adev, &adev->gmc, base);
>> + amdgpu_gmc_gart_location(adev, mc);
>> }
>>
>> /**
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> index 3fe9b9755cf7..fe26bd08b593 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>> @@ -410,8 +410,8 @@ static void gmc_v8_0_vram_gtt_location(struct amdgpu_device *adev,
>> base = RREG32(mmMC_VM_FB_LOCATION) & 0xFFFF;
>> base <<= 24;
>>
>> - amdgpu_device_vram_location(adev, &adev->gmc, base);
>> - amdgpu_device_gart_location(adev, mc);
>> + amdgpu_gmc_vram_location(adev, &adev->gmc, base);
>> + amdgpu_gmc_gart_location(adev, mc);
>> }
>>
>> /**
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>> index d982956c8329..60c8f848c102 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>> @@ -749,8 +749,8 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,
>> u64 base = 0;
>> if (!amdgpu_sriov_vf(adev))
>> base = mmhub_v1_0_get_fb_location(adev);
>> - amdgpu_device_vram_location(adev, &adev->gmc, base);
>> - amdgpu_device_gart_location(adev, mc);
>> + amdgpu_gmc_vram_location(adev, &adev->gmc, base);
>> + amdgpu_gmc_gart_location(adev, mc);
>> /* base offset of vram pages */
>> adev->vm_manager.vram_base_offset = gfxhub_v1_0_get_mc_fb_offset(adev);
>> }
>> --
>> 2.17.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
_______________________________________________
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 1:56 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) [this message]
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)
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=5B84ABD7.4030706@amd.com \
--to=jerry.zhang-5c7gfcevmho@public.gmane.org \
--cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.