Skip to content

Commit f9f4082

Browse files
davejiangvinodkoul
authored andcommitted
dmaengine: idxd: remove interrupt disable for cmd_lock
The cmd_lock spinlock is not being used in hard interrupt context. There is no need to disable irq when acquiring the lock. Convert all cmd_lock acquisition to plain spin_lock() calls. Reviewed-by: Dan Williams <[email protected]> Signed-off-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/162984027930.1939209.15758413737332339204.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <[email protected]>
1 parent d807132 commit f9f4082

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

drivers/dma/idxd/device.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ int idxd_device_init_reset(struct idxd_device *idxd)
462462
{
463463
struct device *dev = &idxd->pdev->dev;
464464
union idxd_command_reg cmd;
465-
unsigned long flags;
466465

467466
if (idxd_device_is_halted(idxd)) {
468467
dev_warn(&idxd->pdev->dev, "Device is HALTED!\n");
@@ -472,13 +471,13 @@ int idxd_device_init_reset(struct idxd_device *idxd)
472471
memset(&cmd, 0, sizeof(cmd));
473472
cmd.cmd = IDXD_CMD_RESET_DEVICE;
474473
dev_dbg(dev, "%s: sending reset for init.\n", __func__);
475-
spin_lock_irqsave(&idxd->cmd_lock, flags);
474+
spin_lock(&idxd->cmd_lock);
476475
iowrite32(cmd.bits, idxd->reg_base + IDXD_CMD_OFFSET);
477476

478477
while (ioread32(idxd->reg_base + IDXD_CMDSTS_OFFSET) &
479478
IDXD_CMDSTS_ACTIVE)
480479
cpu_relax();
481-
spin_unlock_irqrestore(&idxd->cmd_lock, flags);
480+
spin_unlock(&idxd->cmd_lock);
482481
return 0;
483482
}
484483

@@ -487,7 +486,6 @@ static void idxd_cmd_exec(struct idxd_device *idxd, int cmd_code, u32 operand,
487486
{
488487
union idxd_command_reg cmd;
489488
DECLARE_COMPLETION_ONSTACK(done);
490-
unsigned long flags;
491489
u32 stat;
492490

493491
if (idxd_device_is_halted(idxd)) {
@@ -502,7 +500,7 @@ static void idxd_cmd_exec(struct idxd_device *idxd, int cmd_code, u32 operand,
502500
cmd.operand = operand;
503501
cmd.int_req = 1;
504502

505-
spin_lock_irqsave(&idxd->cmd_lock, flags);
503+
spin_lock(&idxd->cmd_lock);
506504
wait_event_lock_irq(idxd->cmd_waitq,
507505
!test_bit(IDXD_FLAG_CMD_RUNNING, &idxd->flags),
508506
idxd->cmd_lock);
@@ -519,18 +517,18 @@ static void idxd_cmd_exec(struct idxd_device *idxd, int cmd_code, u32 operand,
519517
* After command submitted, release lock and go to sleep until
520518
* the command completes via interrupt.
521519
*/
522-
spin_unlock_irqrestore(&idxd->cmd_lock, flags);
520+
spin_unlock(&idxd->cmd_lock);
523521
wait_for_completion(&done);
524522
stat = ioread32(idxd->reg_base + IDXD_CMDSTS_OFFSET);
525-
spin_lock_irqsave(&idxd->cmd_lock, flags);
523+
spin_lock(&idxd->cmd_lock);
526524
if (status)
527525
*status = stat;
528526
idxd->cmd_status = stat & GENMASK(7, 0);
529527

530528
__clear_bit(IDXD_FLAG_CMD_RUNNING, &idxd->flags);
531529
/* Wake up other pending commands */
532530
wake_up(&idxd->cmd_waitq);
533-
spin_unlock_irqrestore(&idxd->cmd_lock, flags);
531+
spin_unlock(&idxd->cmd_lock);
534532
}
535533

536534
int idxd_device_enable(struct idxd_device *idxd)
@@ -641,7 +639,6 @@ int idxd_device_release_int_handle(struct idxd_device *idxd, int handle,
641639
struct device *dev = &idxd->pdev->dev;
642640
u32 operand, status;
643641
union idxd_command_reg cmd;
644-
unsigned long flags;
645642

646643
if (!(idxd->hw.cmd_cap & BIT(IDXD_CMD_RELEASE_INT_HANDLE)))
647644
return -EOPNOTSUPP;
@@ -659,13 +656,13 @@ int idxd_device_release_int_handle(struct idxd_device *idxd, int handle,
659656

660657
dev_dbg(dev, "cmd: %u operand: %#x\n", IDXD_CMD_RELEASE_INT_HANDLE, operand);
661658

662-
spin_lock_irqsave(&idxd->cmd_lock, flags);
659+
spin_lock(&idxd->cmd_lock);
663660
iowrite32(cmd.bits, idxd->reg_base + IDXD_CMD_OFFSET);
664661

665662
while (ioread32(idxd->reg_base + IDXD_CMDSTS_OFFSET) & IDXD_CMDSTS_ACTIVE)
666663
cpu_relax();
667664
status = ioread32(idxd->reg_base + IDXD_CMDSTS_OFFSET);
668-
spin_unlock_irqrestore(&idxd->cmd_lock, flags);
665+
spin_unlock(&idxd->cmd_lock);
669666

670667
if ((status & IDXD_CMDSTS_ERR_MASK) != IDXD_CMDSTS_SUCCESS) {
671668
dev_dbg(dev, "release int handle failed: %#x\n", status);

0 commit comments

Comments
 (0)