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

crypto: ccp - Refactor code to enable checks for queue space.

Available queue space is used to decide (by counting free slots)
if we have to put a command on hold or if it can be sent
to the engine immediately.

Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Gary R Hook and committed by
Herbert Xu
bb4e89b3 8256e683

+9 -2
+7 -1
drivers/crypto/ccp/ccp-dev-v3.c
··· 70 70 wake_up_interruptible_all(&ccp->sb_queue); 71 71 } 72 72 73 + static unsigned int ccp_get_free_slots(struct ccp_cmd_queue *cmd_q) 74 + { 75 + return CMD_Q_DEPTH(ioread32(cmd_q->reg_status)); 76 + } 77 + 73 78 static int ccp_do_cmd(struct ccp_op *op, u32 *cr, unsigned int cr_count) 74 79 { 75 80 struct ccp_cmd_queue *cmd_q = op->cmd_q; ··· 362 357 cmd_q->int_ok = 1 << (i * 2); 363 358 cmd_q->int_err = 1 << ((i * 2) + 1); 364 359 365 - cmd_q->free_slots = CMD_Q_DEPTH(ioread32(cmd_q->reg_status)); 360 + cmd_q->free_slots = ccp_get_free_slots(cmd_q); 366 361 367 362 init_waitqueue_head(&cmd_q->int_queue); 368 363 ··· 564 559 .sbfree = ccp_free_ksb, 565 560 .init = ccp_init, 566 561 .destroy = ccp_destroy, 562 + .get_free_slots = ccp_get_free_slots, 567 563 .irqhandler = ccp_irq_handler, 568 564 }; 569 565
+1
drivers/crypto/ccp/ccp-dev.h
··· 458 458 u32 (*sballoc)(struct ccp_cmd_queue *, unsigned int); 459 459 void (*sbfree)(struct ccp_cmd_queue *, unsigned int, 460 460 unsigned int); 461 + unsigned int (*get_free_slots)(struct ccp_cmd_queue *); 461 462 int (*init)(struct ccp_device *); 462 463 void (*destroy)(struct ccp_device *); 463 464 irqreturn_t (*irqhandler)(int, void *);
+1 -1
drivers/crypto/ccp/ccp-ops.c
··· 1765 1765 cmd->engine_error = 0; 1766 1766 cmd_q->cmd_error = 0; 1767 1767 cmd_q->int_rcvd = 0; 1768 - cmd_q->free_slots = CMD_Q_DEPTH(ioread32(cmd_q->reg_status)); 1768 + cmd_q->free_slots = cmd_q->ccp->vdata->perform->get_free_slots(cmd_q); 1769 1769 1770 1770 switch (cmd->engine) { 1771 1771 case CCP_ENGINE_AES: