From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Cc: "Srinivasan Shanmugam" <srinivasan.shanmugam@amd.com>,
"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH 02/17] drm/amdgpu: Add infrastructure for Cleaner Shader feature
Date: Thu, 22 Aug 2024 08:24:43 +0200 [thread overview]
Message-ID: <e4cc2e51-4d2b-4130-b028-44794c25a30b@gmail.com> (raw)
In-Reply-To: <20240815000501.1845226-3-alexander.deucher@amd.com>
[-- Attachment #1: Type: text/plain, Size: 4037 bytes --]
Am 15.08.24 um 02:04 schrieb Alex Deucher:
> From: Srinivasan Shanmugam<srinivasan.shanmugam@amd.com>
>
> The cleaner shader is used by the CP firmware to clean LDS and GPRs
> between processes on the CUs.
>
> This adds an internal API for GFX IP code to allocate and initialize the
> cleaner shader.
>
> Cc: Christian König<christian.koenig@amd.com>
> Cc: Alex Deucher<alexander.deucher@amd.com>
> Signed-off-by: Alex Deucher<alexander.deucher@amd.com>
> Signed-off-by: Srinivasan Shanmugam<srinivasan.shanmugam@amd.com>
> Suggested-by: Christian König<christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 35 +++++++++++++++++++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 14 ++++++++++
> 2 files changed, 49 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 9be8cafdcecc..4ed69fcfe9c1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -1416,3 +1416,38 @@ void amdgpu_gfx_sysfs_fini(struct amdgpu_device *adev)
> device_remove_file(adev->dev, &dev_attr_current_compute_partition);
> device_remove_file(adev->dev, &dev_attr_available_compute_partition);
> }
> +
> +int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev,
> + unsigned int cleaner_shader_size)
> +{
> + if (!adev->gfx.enable_cleaner_shader)
> + return -EOPNOTSUPP;
It's probably better to not call the function in the first place instead
of returning an error.
> +
> + return amdgpu_bo_create_kernel(adev, cleaner_shader_size, PAGE_SIZE,
> + AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT,
> + &adev->gfx.cleaner_shader_obj,
> + &adev->gfx.cleaner_shader_gpu_addr,
> + (void **)&adev->gfx.cleaner_shader_cpu_ptr);
> +}
> +
> +void amdgpu_gfx_cleaner_shader_sw_fini(struct amdgpu_device *adev)
> +{
> + if (!adev->gfx.enable_cleaner_shader)
> + return;
> +
> + amdgpu_bo_free_kernel(&adev->gfx.cleaner_shader_obj,
> + &adev->gfx.cleaner_shader_gpu_addr,
> + (void **)&adev->gfx.cleaner_shader_cpu_ptr);
> +}
> +
> +void amdgpu_gfx_cleaner_shader_init(struct amdgpu_device *adev,
> + unsigned int cleaner_shader_size,
> + const void *cleaner_shader_ptr)
> +{
> + if (!adev->gfx.enable_cleaner_shader)
> + return;
> +
> + if (adev->gfx.cleaner_shader_cpu_ptr && cleaner_shader_ptr)
> + memcpy_toio(adev->gfx.cleaner_shader_cpu_ptr, cleaner_shader_ptr,
> + cleaner_shader_size);
> +}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> index 6fe77e483bb7..5ff3ab7d429a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> @@ -444,6 +444,14 @@ struct amdgpu_gfx {
> uint32_t *ip_dump_core;
> uint32_t *ip_dump_compute_queues;
> uint32_t *ip_dump_gfx_queues;
> +
> + /* cleaner shader */
> + struct amdgpu_bo *cleaner_shader_obj;
> + unsigned int cleaner_shader_size;
This is a parameter now and the member unused.
> + u64 cleaner_shader_gpu_addr;
> + void *cleaner_shader_cpu_ptr;
> + const void *cleaner_shader_ptr;
> + bool enable_cleaner_shader;
Probably better to test if cleaner_shader_obj is allocated or not
instead of having a separate bool.
Regards,
Christian.
> };
>
> struct amdgpu_gfx_ras_reg_entry {
> @@ -545,6 +553,12 @@ void amdgpu_gfx_ras_error_func(struct amdgpu_device *adev,
> void *ras_error_status,
> void (*func)(struct amdgpu_device *adev, void *ras_error_status,
> int xcc_id));
> +int amdgpu_gfx_cleaner_shader_sw_init(struct amdgpu_device *adev,
> + unsigned int cleaner_shader_size);
> +void amdgpu_gfx_cleaner_shader_sw_fini(struct amdgpu_device *adev);
> +void amdgpu_gfx_cleaner_shader_init(struct amdgpu_device *adev,
> + unsigned int cleaner_shader_size,
> + const void *cleaner_shader_ptr);
>
> static inline const char *amdgpu_gfx_compute_mode_desc(int mode)
> {
[-- Attachment #2: Type: text/html, Size: 5764 bytes --]
next prev parent reply other threads:[~2024-08-22 6:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 0:04 [PATCH 00/17] Process Isolation Support Alex Deucher
2024-08-15 0:04 ` [PATCH 01/17] drm/amdgpu: handle enforce isolation on non-0 gfxhub Alex Deucher
2024-08-15 3:00 ` SRINIVASAN SHANMUGAM
2024-08-15 0:04 ` [PATCH 02/17] drm/amdgpu: Add infrastructure for Cleaner Shader feature Alex Deucher
2024-08-22 6:24 ` Christian König [this message]
2024-08-15 0:04 ` [PATCH 03/17] drm/amdgpu: Emit cleaner shader at end of IB submission Alex Deucher
2024-08-15 0:04 ` [PATCH 04/17] drm/amdgpu: Make enforce_isolation setting per GPU Alex Deucher
2024-08-15 0:04 ` [PATCH 05/17] drm/amdgpu: Enforce isolation as part of the job Alex Deucher
2024-08-15 0:04 ` [PATCH 06/17] drm/amdgpu: Add enforce_isolation sysfs attribute Alex Deucher
2024-08-15 0:04 ` [PATCH 07/17] drm/amdgpu: Add sysfs interface for running cleaner shader Alex Deucher
2024-08-22 6:29 ` Christian König
2024-08-15 0:04 ` [PATCH 08/17] drm/amdgpu: Add PACKET3_RUN_CLEANER_SHADER for cleaner shader execution Alex Deucher
2024-08-15 0:04 ` [PATCH 09/17] drm/amdgpu/gfx9: Implement cleaner shader support for GFX9 hardware Alex Deucher
2024-08-15 0:04 ` [PATCH 10/17] drm/amdgpu/gfx9: Implement cleaner shader support for GFX9.4.3 hardware Alex Deucher
2024-08-15 0:04 ` [PATCH 11/17] drm/amdgpu/gfx9: Add cleaner shader for GFX9.4.3 Alex Deucher
2024-08-15 0:04 ` [PATCH 12/17] drm/amdgpu/gfx9: Add cleaner shader support for GFX9.4.4 hardware Alex Deucher
2024-08-15 0:04 ` [PATCH 13/17] drm/amdkfd: APIs to stop/start KFD scheduling Alex Deucher
2024-08-15 0:04 ` [PATCH 14/17] drm/amdgpu: Implement Enforce Isolation Handler for KGD/KFD serialization Alex Deucher
2024-08-15 0:04 ` [PATCH 15/17] drm/amdgpu/gfx9: Apply Isolation Enforcement to GFX & Compute rings Alex Deucher
2024-08-22 6:35 ` Christian König
2024-08-15 0:05 ` [PATCH 16/17] drm/amdgpu/gfx_v9_4_3: " Alex Deucher
2024-08-15 0:05 ` [PATCH 17/17] drm/amdkfd: Enable processes isolation on gfx9 Alex Deucher
2024-08-22 6:36 ` [PATCH 00/17] Process Isolation Support 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=e4cc2e51-4d2b-4130-b028-44794c25a30b@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=srinivasan.shanmugam@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