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

ioat: preserve chanctrl bits when re-arming interrupts

The register write in ioat_dma_cleanup_tasklet is unfortunate in two
ways:
1/ It clears the extra 'enable' bits that we set at alloc_chan_resources time
2/ It gives the impression that it disables interrupts when it is in
fact re-arming interrupts

[ Impact: fix, persist the value of the chanctrl register when re-arming ]

Signed-off-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

+10 -14
+3 -7
drivers/dma/ioat/dma.c
··· 452 452 struct ioat_dma_chan *ioat = to_ioat_chan(c); 453 453 struct ioat_chan_common *chan = &ioat->base; 454 454 struct ioat_desc_sw *desc; 455 - u16 chanctrl; 456 455 u32 chanerr; 457 456 int i; 458 457 LIST_HEAD(tmp_list); ··· 461 462 return ioat->desccount; 462 463 463 464 /* Setup register to interrupt and write completion status on error */ 464 - chanctrl = IOAT_CHANCTRL_ERR_INT_EN | 465 - IOAT_CHANCTRL_ANY_ERR_ABORT_EN | 466 - IOAT_CHANCTRL_ERR_COMPLETION_EN; 467 - writew(chanctrl, chan->reg_base + IOAT_CHANCTRL_OFFSET); 465 + writew(IOAT_CHANCTRL_RUN, chan->reg_base + IOAT_CHANCTRL_OFFSET); 468 466 469 467 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); 470 468 if (chanerr) { ··· 668 672 static void ioat1_cleanup_tasklet(unsigned long data) 669 673 { 670 674 struct ioat_dma_chan *chan = (void *)data; 675 + 671 676 ioat1_cleanup(chan); 672 - writew(IOAT_CHANCTRL_INT_DISABLE, 673 - chan->base.reg_base + IOAT_CHANCTRL_OFFSET); 677 + writew(IOAT_CHANCTRL_RUN, chan->base.reg_base + IOAT_CHANCTRL_OFFSET); 674 678 } 675 679 676 680 static void ioat_unmap(struct pci_dev *pdev, dma_addr_t addr, size_t len,
+2 -6
drivers/dma/ioat/dma_v2.c
··· 341 341 struct ioat2_dma_chan *ioat = (void *) data; 342 342 343 343 ioat2_cleanup(ioat); 344 - writew(IOAT_CHANCTRL_INT_DISABLE, 345 - ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); 344 + writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); 346 345 } 347 346 348 347 /** ··· 453 454 struct ioat2_dma_chan *ioat = to_ioat2_chan(c); 454 455 struct ioat_chan_common *chan = &ioat->base; 455 456 struct ioat_ring_ent **ring; 456 - u16 chanctrl; 457 457 u32 chanerr; 458 458 int descs; 459 459 int i; ··· 462 464 return 1 << ioat->alloc_order; 463 465 464 466 /* Setup register to interrupt and write completion status on error */ 465 - chanctrl = IOAT_CHANCTRL_ERR_INT_EN | IOAT_CHANCTRL_ANY_ERR_ABORT_EN | 466 - IOAT_CHANCTRL_ERR_COMPLETION_EN; 467 - writew(chanctrl, chan->reg_base + IOAT_CHANCTRL_OFFSET); 467 + writew(IOAT_CHANCTRL_RUN, chan->reg_base + IOAT_CHANCTRL_OFFSET); 468 468 469 469 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); 470 470 if (chanerr) {
+5 -1
drivers/dma/ioat/registers.h
··· 75 75 #define IOAT_CHANCTRL_ERR_INT_EN 0x0010 76 76 #define IOAT_CHANCTRL_ANY_ERR_ABORT_EN 0x0008 77 77 #define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004 78 - #define IOAT_CHANCTRL_INT_DISABLE 0x0001 78 + #define IOAT_CHANCTRL_INT_REARM 0x0001 79 + #define IOAT_CHANCTRL_RUN (IOAT_CHANCTRL_INT_REARM |\ 80 + IOAT_CHANCTRL_ERR_COMPLETION_EN |\ 81 + IOAT_CHANCTRL_ANY_ERR_ABORT_EN |\ 82 + IOAT_CHANCTRL_ERR_INT_EN) 79 83 80 84 #define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatibility */ 81 85 #define IOAT_DMA_COMP_V1 0x0001 /* Compatibility with DMA version 1 */