diff options
author | Benjamin Dotan <bdotan@habana.ai> | 2023-07-20 13:03:43 +0300 |
---|---|---|
committer | Oded Gabbay <ogabbay@kernel.org> | 2023-10-09 12:37:20 +0300 |
commit | 428f6882a6f9fc0521eb2dca5293436d5a041ff3 (patch) | |
tree | 152a2bcfc1dc315a2991d33e445c0eec58957feb /drivers/accel/habanalabs/gaudi2 | |
parent | cf1ed52d12097b743da17dfa34db01f2c18537a5 (diff) | |
download | lwn-428f6882a6f9fc0521eb2dca5293436d5a041ff3.tar.gz lwn-428f6882a6f9fc0521eb2dca5293436d5a041ff3.zip |
accel/habanalabs: fix ETR/ETF flush logic
When config_etr or config_etf are called we need to validate the
parameters that are passed into them to make sure the requested
operation is valid.
Signed-off-by: Benjamin Dotan <bdotan@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/accel/habanalabs/gaudi2')
-rw-r--r-- | drivers/accel/habanalabs/gaudi2/gaudi2_coresight.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/accel/habanalabs/gaudi2/gaudi2_coresight.c b/drivers/accel/habanalabs/gaudi2/gaudi2_coresight.c index 3e90bc969264..32e0f1a85b35 100644 --- a/drivers/accel/habanalabs/gaudi2/gaudi2_coresight.c +++ b/drivers/accel/habanalabs/gaudi2/gaudi2_coresight.c @@ -2092,6 +2092,11 @@ static int gaudi2_config_etf(struct hl_device *hdev, struct hl_debug_params *par if (rc) return -EIO; + val = RREG32(base_reg + mmETF_CTL_OFFSET); + + if ((!params->enable && val == 0x0) || (params->enable && val != 0x0)) + return 0; + val = RREG32(base_reg + mmETF_FFCR_OFFSET); val |= 0x1000; WREG32(base_reg + mmETF_FFCR_OFFSET, val); @@ -2189,6 +2194,11 @@ static int gaudi2_config_etr(struct hl_device *hdev, struct hl_ctx *ctx, if (rc) return -EIO; + val = RREG32(mmPSOC_ETR_CTL); + + if ((!params->enable && val == 0x0) || (params->enable && val != 0x0)) + return 0; + val = RREG32(mmPSOC_ETR_FFCR); val |= 0x1000; WREG32(mmPSOC_ETR_FFCR, val); |