drm/amdkfd: enable grace period for xcp instance
Subsystems (3)
PATCH 1/1 drm/amdkfd: enable grace period for xcp instance
Read/write grace period from/to first xcc instance of xcp in kfd node.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++++--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c | 10 +++++++--- 3 files changed, 16 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +8 -3
@@ -1619,10 +1619,15 @@ 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 inst =ffs (dqm->dev->xcc_mask & + (1UL << + dqm->dev->xcp->id * + dqm->dev->adev->gfx.num_xcc_per_xcp)) -1 ; dqm->dev->kfd2kgd->get_iq_wait_times (dqm->dev->adev, - &dqm->wait_times, -0 ); + &dqm->wait_times[inst], + inst); + }return 0 ; }
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +1 -1
@@ -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 ];wait_queue_head_t destroy_wait; };
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +7 -3
@@ -292,17 +292,21 @@ 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 inst =ffs (pm->dqm->dev->xcc_mask & + (1UL << + pm->dqm->dev->xcp->id * + pm->dqm->dev->adev->gfx.num_xcc_per_xcp)) -1 ; pm->dqm->dev->kfd2kgd->build_grace_period_packet_info ( pm->dqm->dev->adev, - pm->dqm->wait_times, + pm->dqm->wait_times[inst], grace_period, ®_offset, ®_data, -0 ); + inst);if (grace_period ==USE_DEFAULT_GRACE_PERIOD ) - reg_data = pm->dqm->wait_times; + reg_data = pm->dqm->wait_times[inst]; packet = (struct pm4_mec_write_data_mmio *)buffer;memset (buffer,0 ,sizeof (struct pm4_mec_write_data_mmio ));
Signature · 1 line
2.34.1
[AMD Official Use Only - General]
Quoted 9 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Eric Huang
Sent: Monday, July 10, 2023 3:46 PM
To: [email protected]
Cc: Huang, JinHuiEric <[email protected]>; Kim, Jonathan <[email protected]>
Subject: [PATCH] drm/amdkfd: enable grace period for xcp instance
Quoted 6 lines
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Read/write grace period from/to first xcc instance of xcp in kfd node.
Hi Eric,
My patch, "drm/amdkfd: Update CWSR grace period for GFX9.4.3", which got missed during the merge should handle most of what you are trying to do.
I will push that patch. Please add on top if there is anything missing.
Hope that works for you.
Thanks,
Mukul
Quoted 82 lines
Signed-off-by Eric Huang <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++++--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c | 10 +++++++--- 3 files changed, 16 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +9
-3@@ -1619,10 +1619,15 @@ 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 inst =ffs (dqm->dev->xcc_mask & + (1UL << + dqm->dev->xcp->id * + dqm->dev->adev->gfx.num_xcc_per_xcp)) - +1 ; dqm->dev->kfd2kgd->get_iq_wait_times (dqm->dev->adev, - &dqm->wait_times, -0 ); + &dqm->wait_times[inst], + inst); + }return 0 ; }drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +1
-1@@ -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 ];wait_queue_head_t destroy_wait; };drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +8
-4@@ -292,17 +292,21 @@ static int pm_set_grace_period_v9(structpacket_manager *pm, struct pm4_mec_write_data_mmio *packet;uint32_t reg_offset =0 ;uint32_t reg_data =0 ; +uint32_t inst =ffs (pm->dqm->dev->xcc_mask & + (1UL << + pm->dqm->dev->xcp->id * + pm->dqm->dev->adev->gfx.num_xcc_per_xcp)) - +1 ; pm->dqm->dev->kfd2kgd->build_grace_period_packet_info ( pm->dqm->dev->adev, - pm->dqm->wait_times, + pm->dqm->wait_times[inst], grace_period, ®_offset, ®_data, -0 ); + inst);if (grace_period ==USE_DEFAULT_GRACE_PERIOD ) - reg_data = pm->dqm->wait_times; + reg_data = pm->dqm->wait_times[inst]; packet = (struct pm4_mec_write_data_mmio *)buffer;memset (buffer,0 ,sizeof (struct pm4_mec_write_data_mmio )); --2.34.1
OK. Mukul, I will resend this patch based on top of yours.
Regards,
Eric
Quoted 110 lines · Mukul
[AMD Official Use Only - General]
Quoted 9 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Eric Huang
Sent: Monday, July 10, 2023 3:46 PM
To: [email protected]
Cc: Huang, JinHuiEric <[email protected]>; Kim, Jonathan <[email protected]>
Subject: [PATCH] drm/amdkfd: enable grace period for xcp instanceQuoted 6 lines
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Read/write grace period from/to first xcc instance of xcp in kfd node.
Hi Eric,
My patch, "drm/amdkfd: Update CWSR grace period for GFX9.4.3", which got missed during the merge should handle most of what you are trying to do.
I will push that patch. Please add on top if there is anything missing.Hope that works for you.
Thanks,
MukulQuoted 82 lines
Signed-off-by Eric Huang <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 ++++++++--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c | 10 +++++++--- 3 files changed, 16 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +9
-3@@ -1619,10 +1619,15 @@ 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 inst =ffs (dqm->dev->xcc_mask & + (1UL << + dqm->dev->xcp->id * + dqm->dev->adev->gfx.num_xcc_per_xcp)) - +1 ; dqm->dev->kfd2kgd->get_iq_wait_times (dqm->dev->adev, - &dqm->wait_times, -0 ); + &dqm->wait_times[inst], + inst); + }return 0 ; }drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +1
-1@@ -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 ];wait_queue_head_t destroy_wait; };drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +8
-4@@ -292,17 +292,21 @@ static int pm_set_grace_period_v9(structpacket_manager *pm, struct pm4_mec_write_data_mmio *packet;uint32_t reg_offset =0 ;uint32_t reg_data =0 ; +uint32_t inst =ffs (pm->dqm->dev->xcc_mask & + (1UL << + pm->dqm->dev->xcp->id * + pm->dqm->dev->adev->gfx.num_xcc_per_xcp)) - +1 ; pm->dqm->dev->kfd2kgd->build_grace_period_packet_info ( pm->dqm->dev->adev, - pm->dqm->wait_times, + pm->dqm->wait_times[inst], grace_period, ®_offset, ®_data, -0 ); + inst);if (grace_period ==USE_DEFAULT_GRACE_PERIOD ) - reg_data = pm->dqm->wait_times; + reg_data = pm->dqm->wait_times[inst]; packet = (struct pm4_mec_write_data_mmio *)buffer;memset (buffer,0 ,sizeof (struct pm4_mec_write_data_mmio )); --2.34.1