aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2019-02-22 12:00:10 -0500
committerVinod Koul <vkoul@kernel.org>2019-02-25 01:48:38 -0500
commit528314b503f855b268ae7861ea4e206fbbfb8356 (patch)
tree873bde942ff9be7959da78f4ac62cf6a1976f656
parente0100d40906d5dbe6d09d31083c1a5aaccc947fa (diff)
dmaengine: ioatdma: support latency tolerance report (LTR) for v3.4
IOATDMA 3.4 supports PCIe LTR mechanism. The registers are non-standard PCIe LTR support. This needs to be setup in order to not suffer performance impact and provide proper power management. The channel is set to active when it is allocated, and to passive when it's freed. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r--drivers/dma/ioat/init.c27
-rw-r--r--drivers/dma/ioat/registers.h14
2 files changed, 41 insertions, 0 deletions
diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
index 020bcdecb3fb..d41dc9a9ff68 100644
--- a/drivers/dma/ioat/init.c
+++ b/drivers/dma/ioat/init.c
@@ -638,6 +638,11 @@ static void ioat_free_chan_resources(struct dma_chan *c)
638 ioat_stop(ioat_chan); 638 ioat_stop(ioat_chan);
639 ioat_reset_hw(ioat_chan); 639 ioat_reset_hw(ioat_chan);
640 640
641 /* Put LTR to idle */
642 if (ioat_dma->version >= IOAT_VER_3_4)
643 writeb(IOAT_CHAN_LTR_SWSEL_IDLE,
644 ioat_chan->reg_base + IOAT_CHAN_LTR_SWSEL_OFFSET);
645
641 spin_lock_bh(&ioat_chan->cleanup_lock); 646 spin_lock_bh(&ioat_chan->cleanup_lock);
642 spin_lock_bh(&ioat_chan->prep_lock); 647 spin_lock_bh(&ioat_chan->prep_lock);
643 descs = ioat_ring_space(ioat_chan); 648 descs = ioat_ring_space(ioat_chan);
@@ -727,6 +732,28 @@ static int ioat_alloc_chan_resources(struct dma_chan *c)
727 spin_unlock_bh(&ioat_chan->prep_lock); 732 spin_unlock_bh(&ioat_chan->prep_lock);
728 spin_unlock_bh(&ioat_chan->cleanup_lock); 733 spin_unlock_bh(&ioat_chan->cleanup_lock);
729 734
735 /* Setting up LTR values for 3.4 or later */
736 if (ioat_chan->ioat_dma->version >= IOAT_VER_3_4) {
737 u32 lat_val;
738
739 lat_val = IOAT_CHAN_LTR_ACTIVE_SNVAL |
740 IOAT_CHAN_LTR_ACTIVE_SNLATSCALE |
741 IOAT_CHAN_LTR_ACTIVE_SNREQMNT;
742 writel(lat_val, ioat_chan->reg_base +
743 IOAT_CHAN_LTR_ACTIVE_OFFSET);
744
745 lat_val = IOAT_CHAN_LTR_IDLE_SNVAL |
746 IOAT_CHAN_LTR_IDLE_SNLATSCALE |
747 IOAT_CHAN_LTR_IDLE_SNREQMNT;
748 writel(lat_val, ioat_chan->reg_base +
749 IOAT_CHAN_LTR_IDLE_OFFSET);
750
751 /* Select to active */
752 writeb(IOAT_CHAN_LTR_SWSEL_ACTIVE,
753 ioat_chan->reg_base +
754 IOAT_CHAN_LTR_SWSEL_OFFSET);
755 }
756
730 ioat_start_null_desc(ioat_chan); 757 ioat_start_null_desc(ioat_chan);
731 758
732 /* check that we got off the ground */ 759 /* check that we got off the ground */
diff --git a/drivers/dma/ioat/registers.h b/drivers/dma/ioat/registers.h
index 2b517d6db5fd..99c1c24d465d 100644
--- a/drivers/dma/ioat/registers.h
+++ b/drivers/dma/ioat/registers.h
@@ -253,4 +253,18 @@
253#define IOAT_CHAN_DRS_EN 0x0100 253#define IOAT_CHAN_DRS_EN 0x0100
254#define IOAT_CHAN_DRS_AUTOWRAP 0x0200 254#define IOAT_CHAN_DRS_AUTOWRAP 0x0200
255 255
256#define IOAT_CHAN_LTR_SWSEL_OFFSET 0xBC
257#define IOAT_CHAN_LTR_SWSEL_ACTIVE 0x0
258#define IOAT_CHAN_LTR_SWSEL_IDLE 0x1
259
260#define IOAT_CHAN_LTR_ACTIVE_OFFSET 0xC0
261#define IOAT_CHAN_LTR_ACTIVE_SNVAL 0x0000 /* 0 us */
262#define IOAT_CHAN_LTR_ACTIVE_SNLATSCALE 0x0800 /* 1us scale */
263#define IOAT_CHAN_LTR_ACTIVE_SNREQMNT 0x8000 /* snoop req enable */
264
265#define IOAT_CHAN_LTR_IDLE_OFFSET 0xC4
266#define IOAT_CHAN_LTR_IDLE_SNVAL 0x0258 /* 600 us */
267#define IOAT_CHAN_LTR_IDLE_SNLATSCALE 0x0800 /* 1us scale */
268#define IOAT_CHAN_LTR_IDLE_SNREQMNT 0x8000 /* snoop req enable */
269
256#endif /* _IOAT_REGISTERS_H_ */ 270#endif /* _IOAT_REGISTERS_H_ */