public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: 康剑斌 <kjbmail@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: dan.j.williams@intel.com
Subject: Can I/OAT DMA engineer access PCI MMIO space
Date: Fri, 29 Apr 2011 18:13:04 +0800	[thread overview]
Message-ID: <4DBA8F30.2060206@gmail.com> (raw)

I try to use ioatdam to copy data from system memory to pci MMIO space:

=======================
void mmio_copy(void *dst, void *src, size_t len)
struct async_submit_ctl submit;
struct memcpy_context ctx;

atomic_set(&ctx.cnt, 1);
init_completion(&ctx.cmp);
init_async_submit(&submit, ASYNC_TX_ACK, NULL,
done_memcpy, &ctx, NULL);

while (len) {
size_t clen = (len > PAGE_SIZE) ? PAGE_SIZE : len;
struct page *p_dst, *p_src;

p_dst = virt_to_page(dst);
p_src = virt_to_page(src);

atomic_inc(&ctx.cnt);

ntb_async_memcpy(p_dst, p_src, 0, 0, clen, &submit);

dst += clen;
src += clen;
len -= clen;
}

if (atomic_dec_and_test(&ctx.cnt))
return;

async_tx_issue_pending_all();
wait_for_completion(&ctx.cmp);
=================

If dst points to a memory space, the operation would pass.
But if dst points to a pci MMIO space, it failed with kernel oops.
It seems the code:
BUG_ON(is_ioat_bug(chanerr));
in drivers/dma/ioat/dma_v3.c, line 365 cause the oops.
Is there anyway to access pci MMIO space using ioat?
The datasheet says that ioat supports MMIO access.



             reply	other threads:[~2011-04-29 10:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29 10:13 康剑斌 [this message]
2011-05-02  6:04 ` Can I/OAT DMA engineer access PCI MMIO space Koul, Vinod
2011-05-03  2:21   ` 康剑斌
2011-05-03  4:12     ` Koul, Vinod
2011-05-03  6:31       ` 康剑斌
2011-05-03 15:58         ` Dan Williams
2011-05-05  8:45           ` 康剑斌
2011-05-05 15:11             ` Dan Williams
2011-05-03 16:05     ` Dan Williams

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=4DBA8F30.2060206@gmail.com \
    --to=kjbmail@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /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