From: Felix Kuehling <felix.kuehling@amd.com>
To: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdkfd: enable grace period for xcp instance
Date: Tue, 11 Jul 2023 14:38:47 -0400 [thread overview]
Message-ID: <be92a672-8d30-9863-e9a8-ad8bd1d96898@amd.com> (raw)
In-Reply-To: <20230711142807.68327-1-jinhuieric.huang@amd.com>
On 2023-07-11 10:28, Eric Huang wrote:
> Read/write grace period from/to first xcc instance of
> xcp in kfd node.
>
> Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
> ---
> .../drm/amd/amdkfd/kfd_device_queue_manager.c | 21 ++++++++++++-------
> .../drm/amd/amdkfd/kfd_device_queue_manager.h | 2 +-
> .../drm/amd/amdkfd/kfd_packet_manager_v9.c | 8 ++++---
> 3 files changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index 31cac1fd0d58..9000c4b778fd 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -1619,10 +1619,14 @@ static int initialize_cpsch(struct device_queue_manager *dqm)
>
> init_sdma_bitmaps(dqm);
>
> - if (dqm->dev->kfd2kgd->get_iq_wait_times)
> + if (dqm->dev->kfd2kgd->get_iq_wait_times) {
> + u32 first_inst = dqm->dev->xcp->id *
> + dqm->dev->adev->gfx.num_xcc_per_xcp;
> dqm->dev->kfd2kgd->get_iq_wait_times(dqm->dev->adev,
> - &dqm->wait_times,
> - ffs(dqm->dev->xcc_mask) - 1);
> + &dqm->wait_times[first_inst],
> + first_inst);
> + }
> +
> return 0;
> }
>
> @@ -1675,13 +1679,16 @@ static int start_cpsch(struct device_queue_manager *dqm)
> grace_period);
> if (retval)
> pr_err("Setting grace timeout failed\n");
> - else if (dqm->dev->kfd2kgd->build_grace_period_packet_info)
> + else if (dqm->dev->kfd2kgd->build_grace_period_packet_info) {
> + u32 first_inst = dqm->dev->xcp->id *
> + dqm->dev->adev->gfx.num_xcc_per_xcp;
> /* Update dqm->wait_times maintained in software */
> dqm->dev->kfd2kgd->build_grace_period_packet_info(
> - dqm->dev->adev, dqm->wait_times,
> + dqm->dev->adev, dqm->wait_times[first_inst],
> grace_period, ®_offset,
> - &dqm->wait_times,
> - ffs(dqm->dev->xcc_mask) - 1);
> + &dqm->wait_times[first_inst],
> + first_inst);
> + }
> }
>
> dqm_unlock(dqm);
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
> index 7dd4b177219d..45959c33b944 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
> @@ -262,7 +262,7 @@ struct device_queue_manager {
> /* used for GFX 9.4.3 only */
> uint32_t current_logical_xcc_start;
>
> - uint32_t wait_times;
> + uint32_t wait_times[MAX_XCP];
Why do you need an array here, if it only saves the wait times in one of
the array entries [first_inst]?
Regards,
Felix
>
> wait_queue_head_t destroy_wait;
> };
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
> index 8fda16e6fee6..960404a6379b 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
> @@ -292,17 +292,19 @@ static int pm_set_grace_period_v9(struct packet_manager *pm,
> struct pm4_mec_write_data_mmio *packet;
> uint32_t reg_offset = 0;
> uint32_t reg_data = 0;
> + uint32_t first_inst = pm->dqm->dev->xcp->id *
> + pm->dqm->dev->adev->gfx.num_xcc_per_xcp;
>
> pm->dqm->dev->kfd2kgd->build_grace_period_packet_info(
> pm->dqm->dev->adev,
> - pm->dqm->wait_times,
> + pm->dqm->wait_times[first_inst],
> grace_period,
> ®_offset,
> ®_data,
> - 0);
> + first_inst);
>
> if (grace_period == USE_DEFAULT_GRACE_PERIOD)
> - reg_data = pm->dqm->wait_times;
> + reg_data = pm->dqm->wait_times[first_inst];
>
> packet = (struct pm4_mec_write_data_mmio *)buffer;
> memset(buffer, 0, sizeof(struct pm4_mec_write_data_mmio));
next prev parent reply other threads:[~2023-07-11 18:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 14:28 [PATCH] drm/amdkfd: enable grace period for xcp instance Eric Huang
2023-07-11 15:06 ` Kim, Jonathan
2023-07-11 18:38 ` Felix Kuehling [this message]
2023-07-11 18:48 ` Eric Huang
-- strict thread matches above, loose matches on Subject: below --
2023-07-10 19:45 Eric Huang
2023-07-10 22:24 ` Joshi, Mukul
2023-07-10 22:27 ` Eric Huang
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=be92a672-8d30-9863-e9a8-ad8bd1d96898@amd.com \
--to=felix.kuehling@amd.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