linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kieran Kunhya <kieran618@googlemail.com>
To: linux-block@vger.kernel.org
Subject: DMA memory from block layer vs pci_alloc_consistent
Date: Thu, 27 Dec 2018 21:31:24 +0000	[thread overview]
Message-ID: <CABGuwEk4NhAKeCDMsH4cZbeTySO67+q=Z6GJ2Jrq0MvKUc8fqA@mail.gmail.com> (raw)

Hello,

I’ve been reverse engineering Sony SxS memory cards, which are simple
PCIe based block devices. I am able to read successfully from the
device with DMA memory allocated using pci_alloc_consistent and
memcpying to the buffer the block device layer provides.

But if I use the dma_addr_t provided by the block device DMA layer, I
get a soft lockup. Is there something special about the dma_addr_t
that comes from the block layer? Is there anything I need to do to it
before passing it to the hardware.

The device’s block size is 2048, the block layer reads two blocks at a time.

Memcpy code is here:
https://github.com/kierank/sxs-linux/blob/master/sxs.c#L98

DMA code is here:
https://github.com/kierank/sxs-linux/blob/dma/sxs.c#L101

Apologies for the untidiness of the code, it’s entirely reverse engineered.
Any help would be appreciated.

Kieran

                 reply	other threads:[~2018-12-27 21:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CABGuwEk4NhAKeCDMsH4cZbeTySO67+q=Z6GJ2Jrq0MvKUc8fqA@mail.gmail.com' \
    --to=kieran618@googlemail.com \
    --cc=linux-block@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;
as well as URLs for NNTP newsgroup(s).