Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: octeontx2 - add timeout for load_fvc completion poll

Adds timeout to exit from possible infinite loop, which polls
on CPT instruction(load_fvc) completion.

Signed-off-by: Srujana Challa <schalla@marvell.com>
Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Bharat Bhushan and committed by
Herbert Xu
2157e50f 0e801fe7

+14 -2
+14 -2
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
··· 1494 1494 dma_addr_t rptr_baddr; 1495 1495 struct pci_dev *pdev; 1496 1496 u32 len, compl_rlen; 1497 + int timeout = 10000; 1497 1498 int ret, etype; 1498 1499 void *rptr; 1499 1500 ··· 1555 1554 etype); 1556 1555 otx2_cpt_fill_inst(&inst, &iq_cmd, rptr_baddr); 1557 1556 lfs->ops->send_cmd(&inst, 1, &cptpf->lfs.lf[0]); 1557 + timeout = 10000; 1558 1558 1559 1559 while (lfs->ops->cpt_get_compcode(result) == 1560 - OTX2_CPT_COMPLETION_CODE_INIT) 1560 + OTX2_CPT_COMPLETION_CODE_INIT) { 1561 1561 cpu_relax(); 1562 + udelay(1); 1563 + timeout--; 1564 + if (!timeout) { 1565 + ret = -ENODEV; 1566 + cptpf->is_eng_caps_discovered = false; 1567 + dev_warn(&pdev->dev, "Timeout on CPT load_fvc completion poll\n"); 1568 + goto error_no_response; 1569 + } 1570 + } 1562 1571 1563 1572 cptpf->eng_caps[etype].u = be64_to_cpup(rptr); 1564 1573 } 1565 - dma_unmap_single(&pdev->dev, rptr_baddr, len, DMA_BIDIRECTIONAL); 1566 1574 cptpf->is_eng_caps_discovered = true; 1567 1575 1576 + error_no_response: 1577 + dma_unmap_single(&pdev->dev, rptr_baddr, len, DMA_BIDIRECTIONAL); 1568 1578 free_result: 1569 1579 kfree(result); 1570 1580 lf_cleanup: