mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jon Mason <jon.mason@intel.com>
To: Dan Williams <djbw@fb.com>
Cc: linux-kernel@vger.kernel.org, Dave Jiang <dave.jiang@intel.com>,
	Vinod Koul <vinod.koul@intel.com>
Subject: [PATCH] ioat: device control support
Date: Fri, 17 May 2013 10:53:47 -0700	[thread overview]
Message-ID: <1368813227-29512-1-git-send-email-jon.mason@intel.com> (raw)

Add device control support for CBDMA v2 and v3 in the ioat driver.
This allows DMA engine clients to call into the ioat driver and issue a
DMA_TERMINATE_ALL.

Signed-off-by: Jon Mason <jon.mason@intel.com>
---
 drivers/dma/ioat/dma_v2.c |   22 ++++++++++++++++++++++
 drivers/dma/ioat/dma_v3.c |   22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index b925e1b..d373ee3 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -847,6 +847,27 @@ void ioat2_free_chan_resources(struct dma_chan *c)
 	ioat->dmacount = 0;
 }
 
+static int ioat2_device_control(struct dma_chan *c, enum dma_ctrl_cmd cmd,
+				unsigned long arg)
+{
+	struct ioat2_dma_chan *ioat = to_ioat2_chan(c);
+	struct ioat_chan_common *chan = &ioat->base;
+
+	switch (cmd) {
+	case DMA_TERMINATE_ALL:
+		spin_lock_bh(&chan->cleanup_lock);
+		spin_lock_bh(&ioat->prep_lock);
+		ioat2_restart_channel(ioat);
+		spin_unlock_bh(&ioat->prep_lock);
+		spin_unlock_bh(&chan->cleanup_lock);
+		break;
+	default:
+		return -ENOSYS;
+	}
+
+	return 0;
+}
+
 static ssize_t ring_size_show(struct dma_chan *c, char *page)
 {
 	struct ioat2_dma_chan *ioat = to_ioat2_chan(c);
@@ -896,6 +917,7 @@ int ioat2_dma_probe(struct ioatdma_device *device, int dca)
 	dma->device_alloc_chan_resources = ioat2_alloc_chan_resources;
 	dma->device_free_chan_resources = ioat2_free_chan_resources;
 	dma->device_tx_status = ioat_dma_tx_status;
+	dma->device_control = ioat2_device_control;
 
 	err = ioat_probe(device);
 	if (err)
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index ca6ea9b..ca6ecdc 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -1833,6 +1833,27 @@ static int ioat3_reset_hw(struct ioat_chan_common *chan)
 	return err;
 }
 
+static int ioat3_device_control(struct dma_chan *c, enum dma_ctrl_cmd cmd,
+				unsigned long arg)
+{
+	struct ioat2_dma_chan *ioat = to_ioat2_chan(c);
+	struct ioat_chan_common *chan = &ioat->base;
+
+	switch (cmd) {
+	case DMA_TERMINATE_ALL:
+		spin_lock_bh(&chan->cleanup_lock);
+		spin_lock_bh(&ioat->prep_lock);
+		ioat3_restart_channel(ioat);
+		spin_unlock_bh(&ioat->prep_lock);
+		spin_unlock_bh(&chan->cleanup_lock);
+		break;
+	default:
+		return -ENOSYS;
+	}
+
+	return 0;
+}
+
 static void ioat3_intr_quirk(struct ioatdma_device *device)
 {
 	struct dma_device *dma;
@@ -1878,6 +1899,7 @@ int ioat3_dma_probe(struct ioatdma_device *device, int dca)
 	dma->device_issue_pending = ioat2_issue_pending;
 	dma->device_alloc_chan_resources = ioat2_alloc_chan_resources;
 	dma->device_free_chan_resources = ioat2_free_chan_resources;
+	dma->device_control = ioat3_device_control;
 
 	if (is_xeon_cb32(pdev))
 		dma->copy_align = 6;
-- 
1.7.9.5


             reply	other threads:[~2013-05-17 17:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-17 17:53 Jon Mason [this message]
2013-05-17 18:04 ` Dave Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368813227-29512-1-git-send-email-jon.mason@intel.com \
    --to=jon.mason@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=djbw@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome