linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Feinman <alex@alexfeinman.com>
To: linux-kernel@vger.kernel.org
Subject: Contiguous DMA buffer view for a custom device (Intel/x86)
Date: Mon, 20 Aug 2018 13:39:06 -0700	[thread overview]
Message-ID: <CAGXJtFFjVTqYraM0OFipYnNbdLt_BojP5U8WhJETLgw4XWehGQ@mail.gmail.com> (raw)

Good morning.
I have a custom PCI device that needs to fill memory buffers of up to 16MB
in size. For various reasons I would like to avoid implementing
scatter-gather support in the device and would much rather prefer a
contiguous buffer view instead. The buffers are allocated using
dma_alloc_coherent or dma_alloc_attrs (as I don't necessarily need coherent
access)

This is on a custom Skylake/Kaby Lake platform

It is my understanding (possibly incorrect) that
a) The contiguous memory space available to subsystems like
videobuf2-dma-contig is limited and I won't be likely to be able tp
allocate say 4 16MB contiguous buffers reliably
b) IOMMU can solve this problem for me by providing a device-specific
contiguous view of a fragmented physical memory allocation
c) In order to enable IOMMU do the above, I need to allocate DRHDs and
DMARs in BIOS initialization (I build my own BIOS)

Please, let me know if I am on the right track? Of course I realize that
implementing SGDMA would be the best option, but short of that and blocking
out some physical memory on boot, what are my options?

Are there any pointers of how exactly achieve this (implementation I could
peruse, articles and whatnot)?

Best regards

Alex Feinman
ReplyForward

             reply	other threads:[~2018-08-20 20:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20 20:39 Alex Feinman [this message]
2018-08-20 20:58 ` Contiguous DMA buffer view for a custom device (Intel/x86) Alan Cox
2018-08-21 23:50   ` Alex Feinman

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=CAGXJtFFjVTqYraM0OFipYnNbdLt_BojP5U8WhJETLgw4XWehGQ@mail.gmail.com \
    --to=alex@alexfeinman.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;
as well as URLs for NNTP newsgroup(s).