From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Alex Deucher <alexdeucher@gmail.com>,
Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/amdgpu/gmc: add a way to force a particular placement for GART
Date: Wed, 27 Sep 2023 07:37:53 +0200 [thread overview]
Message-ID: <2ad761b8-7228-7a00-4514-45464be549f2@gmail.com> (raw)
In-Reply-To: <CADnq5_OSqC1MbV1MJr778CEJsLx5HyaVHDsGae7phReoKMCnuQ@mail.gmail.com>
I'm still not happy with moving the GART fixed to the end. We abandoned
this for good reasons.
If we really go this way I would prefer to have this as parameter to the
amdgpu_gmc_gart_location() function and not in the gmc structure.
Regards,
Christian.
Am 26.09.23 um 19:30 schrieb Alex Deucher:
> Ping on this series?
>
> On Thu, Sep 21, 2023 at 5:46 PM Alex Deucher <alexander.deucher@amd.com> wrote:
>> We normally place GART based on the location of VRAM and the
>> available address space around that, but provide an option
>> to force a particular location for hardware that needs it.
>>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 19 +++++++++++++++----
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 8 ++++++++
>> 2 files changed, 23 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
>> index f74a51a93ebb..d1d98488373b 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
>> @@ -287,11 +287,22 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
>> mc->gart_size = max(size_bf, size_af);
>> }
>>
>> - if ((size_bf >= mc->gart_size && size_bf < size_af) ||
>> - (size_af < mc->gart_size))
>> - mc->gart_start = 0;
>> - else
>> + switch (mc->gart_placement) {
>> + case AMDGPU_GART_PLACEMENT_HIGH:
>> mc->gart_start = max_mc_address - mc->gart_size + 1;
>> + break;
>> + case AMDGPU_GART_PLACEMENT_LOW:
>> + mc->gart_start = 0;
>> + break;
>> + case AMDGPU_GART_PLACEMENT_BEST_FIT:
>> + default:
>> + if ((size_bf >= mc->gart_size && size_bf < size_af) ||
>> + (size_af < mc->gart_size))
>> + mc->gart_start = 0;
>> + else
>> + mc->gart_start = max_mc_address - mc->gart_size + 1;
>> + break;
>> + }
>>
>> mc->gart_start &= ~(four_gb - 1);
>> mc->gart_end = mc->gart_start + mc->gart_size - 1;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
>> index dd0ede75e5d7..fcef057b9213 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
>> @@ -199,6 +199,12 @@ struct amdgpu_mem_partition_info {
>>
>> #define INVALID_PFN -1
>>
>> +enum amdgpu_gart_placement {
>> + AMDGPU_GART_PLACEMENT_BEST_FIT = 0,
>> + AMDGPU_GART_PLACEMENT_HIGH,
>> + AMDGPU_GART_PLACEMENT_LOW,
>> +};
>> +
>> struct amdgpu_gmc {
>> /* FB's physical address in MMIO space (for CPU to
>> * map FB). This is different compared to the agp/
>> @@ -339,6 +345,8 @@ struct amdgpu_gmc {
>> bool flush_tlb_needs_extra_type_0;
>> bool flush_tlb_needs_extra_type_2;
>> bool flush_pasid_uses_kiq;
>> +
>> + enum amdgpu_gart_placement gart_placement;
>> };
>>
>> #define amdgpu_gmc_emit_flush_gpu_tlb(r, vmid, addr) (r)->adev->gmc.gmc_funcs->emit_flush_gpu_tlb((r), (vmid), (addr))
>> --
>> 2.41.0
>>
next prev parent reply other threads:[~2023-09-27 5:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 21:40 [PATCH 1/2] drm/amdgpu/gmc: add a way to force a particular placement for GART Alex Deucher
2023-09-21 21:40 ` [PATCH 2/2] drm/amdgpu/gmc11: set gart placement GC11 Alex Deucher
2023-09-26 17:30 ` [PATCH 1/2] drm/amdgpu/gmc: add a way to force a particular placement for GART Alex Deucher
2023-09-27 5:37 ` Christian König [this message]
2023-09-27 15:13 ` Alex Deucher
2023-09-27 14:12 ` Wang, Yang(Kevin)
-- strict thread matches above, loose matches on Subject: below --
2023-09-27 18:12 Alex Deucher
2023-09-28 13:23 ` Alex Deucher
2023-09-29 10:41 ` Christian König
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=2ad761b8-7228-7a00-4514-45464be549f2@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.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