Skip to content

Commit cfd4176

Browse files
oshpigelmanogabbay
authored andcommitted
habanalabs: use PI in MMU cache invalidation
The PS flow for MMU cache invalidation caused timeouts in stress tests. Use PS + PI flow so no timeouts should happen whatsoever. Signed-off-by: Omer Shpigelman <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
1 parent 64536ab commit cfd4176

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/misc/habanalabs/gaudi/gaudi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,6 +2725,12 @@ static int gaudi_mmu_init(struct hl_device *hdev)
27252725
WREG32(mmSTLB_HOP_CONFIGURATION,
27262726
hdev->mmu_huge_page_opt ? 0x30440 : 0x40440);
27272727

2728+
/*
2729+
* The H/W expects the first PI after init to be 1. After wraparound
2730+
* we'll write 0.
2731+
*/
2732+
gaudi->mmu_cache_inv_pi = 1;
2733+
27282734
gaudi->hw_cap_initialized |= HW_CAP_MMU;
27292735

27302736
return 0;
@@ -6017,6 +6023,8 @@ static int gaudi_mmu_invalidate_cache(struct hl_device *hdev, bool is_hard,
60176023
mutex_lock(&hdev->mmu_cache_lock);
60186024

60196025
/* L0 & L1 invalidation */
6026+
WREG32(mmSTLB_INV_PS, 3);
6027+
WREG32(mmSTLB_CACHE_INV, gaudi->mmu_cache_inv_pi++);
60206028
WREG32(mmSTLB_INV_PS, 2);
60216029

60226030
rc = hl_poll_timeout(

drivers/misc/habanalabs/gaudi/gaudiP.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ struct gaudi_internal_qman_info {
229229
* @multi_msi_mode: whether we are working in multi MSI single MSI mode.
230230
* Multi MSI is possible only with IOMMU enabled.
231231
* @ext_queue_idx: helper index for external queues initialization.
232+
* @mmu_cache_inv_pi: PI for MMU cache invalidation flow. The H/W expects an
233+
* 8-bit value so use u8.
232234
*/
233235
struct gaudi_device {
234236
int (*armcp_info_get)(struct hl_device *hdev);
@@ -248,6 +250,7 @@ struct gaudi_device {
248250
u32 hw_cap_initialized;
249251
u8 multi_msi_mode;
250252
u8 ext_queue_idx;
253+
u8 mmu_cache_inv_pi;
251254
};
252255

253256
void gaudi_init_security(struct hl_device *hdev);

0 commit comments

Comments
 (0)