mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 07:13:27 +07:00
habanalabs: set clock gating according to mask
Once clock gating is set we enable clock gating according to mask, we should also disable clock gating according to relevant bits. Signed-off-by: Ofir Bitton <obitton@habana.ai> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
This commit is contained in:
parent
1cff119740
commit
f44d23b909
@ -2508,6 +2508,7 @@ static void gaudi_set_clock_gating(struct hl_device *hdev)
|
|||||||
{
|
{
|
||||||
struct gaudi_device *gaudi = hdev->asic_specific;
|
struct gaudi_device *gaudi = hdev->asic_specific;
|
||||||
u32 qman_offset;
|
u32 qman_offset;
|
||||||
|
bool enable;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* In case we are during debug session, don't enable the clock gate
|
/* In case we are during debug session, don't enable the clock gate
|
||||||
@ -2517,46 +2518,43 @@ static void gaudi_set_clock_gating(struct hl_device *hdev)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = GAUDI_PCI_DMA_1, qman_offset = 0 ; i < GAUDI_HBM_DMA_1 ; i++) {
|
for (i = GAUDI_PCI_DMA_1, qman_offset = 0 ; i < GAUDI_HBM_DMA_1 ; i++) {
|
||||||
if (!(hdev->clock_gating_mask &
|
enable = !!(hdev->clock_gating_mask &
|
||||||
(BIT_ULL(gaudi_dma_assignment[i]))))
|
(BIT_ULL(gaudi_dma_assignment[i])));
|
||||||
continue;
|
|
||||||
|
|
||||||
qman_offset = gaudi_dma_assignment[i] * DMA_QMAN_OFFSET;
|
qman_offset = gaudi_dma_assignment[i] * DMA_QMAN_OFFSET;
|
||||||
WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset, QMAN_CGM1_PWR_GATE_EN);
|
WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset,
|
||||||
|
enable ? QMAN_CGM1_PWR_GATE_EN : 0);
|
||||||
WREG32(mmDMA0_QM_CGM_CFG + qman_offset,
|
WREG32(mmDMA0_QM_CGM_CFG + qman_offset,
|
||||||
QMAN_UPPER_CP_CGM_PWR_GATE_EN);
|
enable ? QMAN_UPPER_CP_CGM_PWR_GATE_EN : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = GAUDI_HBM_DMA_1 ; i < GAUDI_DMA_MAX ; i++) {
|
for (i = GAUDI_HBM_DMA_1 ; i < GAUDI_DMA_MAX ; i++) {
|
||||||
if (!(hdev->clock_gating_mask &
|
enable = !!(hdev->clock_gating_mask &
|
||||||
(BIT_ULL(gaudi_dma_assignment[i]))))
|
(BIT_ULL(gaudi_dma_assignment[i])));
|
||||||
continue;
|
|
||||||
|
|
||||||
qman_offset = gaudi_dma_assignment[i] * DMA_QMAN_OFFSET;
|
qman_offset = gaudi_dma_assignment[i] * DMA_QMAN_OFFSET;
|
||||||
WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset, QMAN_CGM1_PWR_GATE_EN);
|
WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset,
|
||||||
|
enable ? QMAN_CGM1_PWR_GATE_EN : 0);
|
||||||
WREG32(mmDMA0_QM_CGM_CFG + qman_offset,
|
WREG32(mmDMA0_QM_CGM_CFG + qman_offset,
|
||||||
QMAN_COMMON_CP_CGM_PWR_GATE_EN);
|
enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_0))) {
|
enable = !!(hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_0)));
|
||||||
WREG32(mmMME0_QM_CGM_CFG1, QMAN_CGM1_PWR_GATE_EN);
|
WREG32(mmMME0_QM_CGM_CFG1, enable ? QMAN_CGM1_PWR_GATE_EN : 0);
|
||||||
WREG32(mmMME0_QM_CGM_CFG, QMAN_COMMON_CP_CGM_PWR_GATE_EN);
|
WREG32(mmMME0_QM_CGM_CFG, enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
|
||||||
}
|
|
||||||
|
|
||||||
if (hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_2))) {
|
enable = !!(hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_2)));
|
||||||
WREG32(mmMME2_QM_CGM_CFG1, QMAN_CGM1_PWR_GATE_EN);
|
WREG32(mmMME2_QM_CGM_CFG1, enable ? QMAN_CGM1_PWR_GATE_EN : 0);
|
||||||
WREG32(mmMME2_QM_CGM_CFG, QMAN_COMMON_CP_CGM_PWR_GATE_EN);
|
WREG32(mmMME2_QM_CGM_CFG, enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, qman_offset = 0 ; i < TPC_NUMBER_OF_ENGINES ; i++) {
|
for (i = 0, qman_offset = 0 ; i < TPC_NUMBER_OF_ENGINES ; i++) {
|
||||||
if (!(hdev->clock_gating_mask &
|
enable = !!(hdev->clock_gating_mask &
|
||||||
(BIT_ULL(GAUDI_ENGINE_ID_TPC_0 + i))))
|
(BIT_ULL(GAUDI_ENGINE_ID_TPC_0 + i)));
|
||||||
continue;
|
|
||||||
|
|
||||||
WREG32(mmTPC0_QM_CGM_CFG1 + qman_offset,
|
WREG32(mmTPC0_QM_CGM_CFG1 + qman_offset,
|
||||||
QMAN_CGM1_PWR_GATE_EN);
|
enable ? QMAN_CGM1_PWR_GATE_EN : 0);
|
||||||
WREG32(mmTPC0_QM_CGM_CFG + qman_offset,
|
WREG32(mmTPC0_QM_CGM_CFG + qman_offset,
|
||||||
QMAN_COMMON_CP_CGM_PWR_GATE_EN);
|
enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
|
||||||
|
|
||||||
qman_offset += TPC_QMAN_OFFSET;
|
qman_offset += TPC_QMAN_OFFSET;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user