From: "Christian König" <christian.koenig@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: alexander.deucher@amd.com,
Shashank Sharma <contactshashanksharma@gmail.com>,
amd-gfx@lists.freedesktop.org,
Shashank Sharma <shashank.sharma@amd.com>
Subject: Re: [PATCH 12/13] drm/amdgpu: add domain info in bo_create_kernel_at
Date: Mon, 6 Feb 2023 18:03:46 +0100 [thread overview]
Message-ID: <6f7baf04-2469-4bb2-e184-a15525922fb2@amd.com> (raw)
In-Reply-To: <CADnq5_Nyqs=uXWTY_Q_iJH+yLQ7q_sQFqGzCA5i3HUPC+z5L-A@mail.gmail.com>
Am 06.02.23 um 18:01 schrieb Alex Deucher:
> On Mon, Feb 6, 2023 at 11:51 AM Christian König
> <christian.koenig@amd.com> wrote:
>> Am 03.02.23 um 20:08 schrieb Shashank Sharma:
>>> From: Shashank Sharma <contactshashanksharma@gmail.com>
>>>
>>> This patch adds a domain input variable for amdgpu_bo_create_kernel_at,
>>> so that it could be used for both VRAM and DOORBELL domains objects. It
>>> also adds supporting code for existing callers.
>> We should probably drop this one as well.
>>
>> We just removed the domain from the function because we only have BIOS
>> reserved regions in VRAM, never anywhere else.
>>
>> Allocating a doorbell for the kernel is not really an use case for
>> amdgpu_bo_create_kernel_at().
> We just need some way to guarantee that the kernel always gets the
> first page. It's required for SR-IOV compatibility.
That should be guaranteed when we use ttm_range_manager() since that one
gives you pages in the order you allocate them.
If the first page is already taken then bo_create_kernel_at() won't help
either, you just get a error returned.
Just allocating and returning the error yourself does the same here.
Christian.
>
> Alex
>
>> Christian.
>>
>>> Signed-off-by: Shashank Sharma <contactshashanksharma@gmail.com>
>>> ---
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++--
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 +-
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 +++++++
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 +
>>> 4 files changed, 11 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> index ef1f3106bc69..dec391fa42dc 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> @@ -367,7 +367,7 @@ int amdgpu_bo_create_kernel(struct amdgpu_device *adev,
>>> * 0 on success, negative error code otherwise.
>>> */
>>> int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
>>> - uint64_t offset, uint64_t size,
>>> + uint64_t offset, uint64_t size, uint32_t domain,
>>> struct amdgpu_bo **bo_ptr, void **cpu_addr)
>>> {
>>> struct ttm_operation_ctx ctx = { false, false };
>>> @@ -378,7 +378,7 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
>>> size = ALIGN(size, PAGE_SIZE);
>>>
>>> r = amdgpu_bo_create_reserved(adev, size, PAGE_SIZE,
>>> - AMDGPU_GEM_DOMAIN_VRAM, bo_ptr, NULL,
>>> + domain, bo_ptr, NULL,
>>> cpu_addr);
>>> if (r)
>>> return r;
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>>> index bf9759758f0d..b2b7e55ac486 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>>> @@ -284,7 +284,7 @@ int amdgpu_bo_create_kernel(struct amdgpu_device *adev,
>>> u32 domain, struct amdgpu_bo **bo_ptr,
>>> u64 *gpu_addr, void **cpu_addr);
>>> int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
>>> - uint64_t offset, uint64_t size,
>>> + uint64_t offset, uint64_t size, uint32_t domain,
>>> struct amdgpu_bo **bo_ptr, void **cpu_addr);
>>> int amdgpu_bo_create_user(struct amdgpu_device *adev,
>>> struct amdgpu_bo_param *bp,
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> index 08355f981313..4cec90debe46 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> @@ -1591,6 +1591,7 @@ static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev)
>>> return amdgpu_bo_create_kernel_at(adev,
>>> adev->mman.fw_vram_usage_start_offset,
>>> adev->mman.fw_vram_usage_size,
>>> + AMDGPU_GEM_DOMAIN_VRAM,
>>> &adev->mman.fw_vram_usage_reserved_bo,
>>> &adev->mman.fw_vram_usage_va);
>>> }
>>> @@ -1616,6 +1617,7 @@ static int amdgpu_ttm_drv_reserve_vram_init(struct amdgpu_device *adev)
>>> return amdgpu_bo_create_kernel_at(adev,
>>> adev->mman.drv_vram_usage_start_offset,
>>> adev->mman.drv_vram_usage_size,
>>> + AMDGPU_GEM_DOMAIN_VRAM,
>>> &adev->mman.drv_vram_usage_reserved_bo,
>>> &adev->mman.drv_vram_usage_va);
>>> }
>>> @@ -1696,6 +1698,7 @@ static int amdgpu_ttm_reserve_tmr(struct amdgpu_device *adev)
>>> ret = amdgpu_bo_create_kernel_at(adev,
>>> ctx->c2p_train_data_offset,
>>> ctx->train_data_size,
>>> + AMDGPU_GEM_DOMAIN_VRAM,
>>> &ctx->c2p_bo,
>>> NULL);
>>> if (ret) {
>>> @@ -1709,6 +1712,7 @@ static int amdgpu_ttm_reserve_tmr(struct amdgpu_device *adev)
>>> ret = amdgpu_bo_create_kernel_at(adev,
>>> adev->gmc.real_vram_size - adev->mman.discovery_tmr_size,
>>> adev->mman.discovery_tmr_size,
>>> + AMDGPU_GEM_DOMAIN_VRAM,
>>> &adev->mman.discovery_memory,
>>> NULL);
>>> if (ret) {
>>> @@ -1816,18 +1820,21 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>>> * avoid display artifacts while transitioning between pre-OS
>>> * and driver. */
>>> r = amdgpu_bo_create_kernel_at(adev, 0, adev->mman.stolen_vga_size,
>>> + AMDGPU_GEM_DOMAIN_VRAM,
>>> &adev->mman.stolen_vga_memory,
>>> NULL);
>>> if (r)
>>> return r;
>>> r = amdgpu_bo_create_kernel_at(adev, adev->mman.stolen_vga_size,
>>> adev->mman.stolen_extended_size,
>>> + AMDGPU_GEM_DOMAIN_VRAM,
>>> &adev->mman.stolen_extended_memory,
>>> NULL);
>>> if (r)
>>> return r;
>>> r = amdgpu_bo_create_kernel_at(adev, adev->mman.stolen_reserved_offset,
>>> adev->mman.stolen_reserved_size,
>>> + AMDGPU_GEM_DOMAIN_VRAM,
>>> &adev->mman.stolen_reserved_memory,
>>> NULL);
>>> if (r)
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>>> index fc9edc3028b6..fd1f58158238 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>>> @@ -395,6 +395,7 @@ static void amdgpu_virt_ras_reserve_bps(struct amdgpu_device *adev)
>>> */
>>> if (amdgpu_bo_create_kernel_at(adev, bp << AMDGPU_GPU_PAGE_SHIFT,
>>> AMDGPU_GPU_PAGE_SIZE,
>>> + AMDGPU_GEM_DOMAIN_VRAM,
>>> &bo, NULL))
>>> DRM_DEBUG("RAS WARN: reserve vram for retired page %llx fail\n", bp);
>>>
next prev parent reply other threads:[~2023-02-06 17:04 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 19:08 [PATCH 00/13] Re-design doorbell framework for usermode queues Shashank Sharma
2023-02-03 19:08 ` [PATCH 01/13] drm/amdgpu: add UAPI for allocating doorbell memory Shashank Sharma
2023-02-06 11:19 ` Christian König
2023-02-06 15:31 ` Shashank Sharma
2023-02-03 19:08 ` [PATCH 02/13] drm/amdgpu: rename vram_mgr functions to bar_mgr Shashank Sharma
2023-02-06 11:20 ` Christian König
2023-02-06 15:34 ` Shashank Sharma
2023-02-06 16:03 ` Christian König
2023-02-06 16:17 ` Alex Deucher
2023-02-03 19:08 ` [PATCH 03/13] drm/amdgpu: rename amdgpu_vram_mgr.c/h to amdgpu_bar_mgr.c/h Shashank Sharma
2023-02-03 19:08 ` [PATCH 04/13] drm/amdgpu: replace aper_base_kaddr with vram_aper_base_kaddr Shashank Sharma
2023-02-06 11:21 ` Christian König
2023-02-03 19:08 ` [PATCH 05/13] drm/amdgpu: add doorbell support to amdgpu_bar_mgr Shashank Sharma
2023-02-03 19:08 ` [PATCH 06/13] drm/amdgpu: rename gmc.aper_base/size Shashank Sharma
2023-02-06 11:22 ` Christian König
2023-02-03 19:08 ` [PATCH 07/13] drm/amdgpu: store doorbell info in gmc structure Shashank Sharma
2023-02-06 11:23 ` Christian König
2023-02-03 19:08 ` [PATCH 08/13] drm/amdgpu: move doorbell ptr into mman structure Shashank Sharma
2023-02-06 11:24 ` Christian König
2023-02-03 19:08 ` [PATCH 09/13] drm/amdgpu: accommodate DOMAIN/PL_DOORBELL Shashank Sharma
2023-02-06 11:30 ` Christian König
2023-02-06 16:30 ` Alex Deucher
2023-02-03 19:08 ` [PATCH 09/14] drm/amdgpu: move doorbell aperture handling into ttm_init Shashank Sharma
2023-02-06 16:20 ` Christian König
2023-02-03 19:08 ` [PATCH 10/14] drm/amdgpu: accommodate DOMAIN/PL_DOORBELL Shashank Sharma
2023-02-03 19:08 ` [PATCH 10/13] drm/amdgpu: doorbell support in get_memory functions Shashank Sharma
2023-02-06 16:30 ` Christian König
2023-02-03 19:08 ` [PATCH 11/14] " Shashank Sharma
2023-02-03 19:08 ` [PATCH 11/13] drm/amdgpu: initialize doorbell memory pool Shashank Sharma
2023-02-03 19:08 ` [PATCH 12/13] drm/amdgpu: add domain info in bo_create_kernel_at Shashank Sharma
2023-02-06 16:51 ` Christian König
2023-02-06 17:01 ` Alex Deucher
2023-02-06 17:03 ` Christian König [this message]
2023-02-03 19:08 ` [PATCH 12/14] drm/amdgpu: initialize doorbell memory pool Shashank Sharma
2023-02-06 16:54 ` Christian König
2023-02-03 19:08 ` [PATCH 13/14] drm/amdgpu: add domain info in bo_create_kernel_at Shashank Sharma
2023-02-03 19:08 ` [PATCH 13/13] drm/amdgpu: introduce doorbell bo in kernel Shashank Sharma
2023-02-03 19:08 ` [PATCH 14/14] " Shashank Sharma
2023-02-06 16:57 ` Christian König
2023-02-06 17:19 ` Shashank Sharma
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=6f7baf04-2469-4bb2-e184-a15525922fb2@amd.com \
--to=christian.koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=contactshashanksharma@gmail.com \
--cc=shashank.sharma@amd.com \
/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