From: "Thomas Hellström (VMware)" <thomas_os@shipmail.org>
To: "Christoph Hellwig" <hch@infradead.org>,
"Christian König" <christian.koenig@amd.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: dma coherent memory user-space maps
Date: Tue, 8 Oct 2019 14:34:17 +0200 [thread overview]
Message-ID: <b811f66d-2353-23c6-c9fa-e279cdb0f832@shipmail.org> (raw)
Hi, Christoph,
Following our previous discussion I wonder if something along the lines
of the following could work / be acceptible
typedef unsigned long dma_pfn_t /* Opaque pfn type. Arch dependent. This
could if needed be a struct with a pointer and an offset */
/* Similar to vmf_insert_mixed() */
vm_fault_t dma_vmf_insert_mixed(struct device *dev,
struct vm_area_struct *vma,
unsigned long addr,
dma_pfn_t dpfn,
unsigned long attrs);
/* Similar to vmf_insert_pfn_pmd() */
vm_fault_t dma_vmf_insert_pfn_pmd(struct device *dev,
struct vm_area_struct *vma,
unsigned long addr,
dma_pfn_t dpfn,
unsigned long attrs);
/* Like vmap, but takes struct dma_pfns. */
extern void *dma_vmap(struct device *dev,
dma_pfn_t dpfns[],
unsigned int count, unsigned long flags,
unsigned long attrs);
/* Obtain struct dma_pfn pointers from a dma coherent allocation */
int dma_get_dpfns(struct device *dev, void *cpu_addr, dma_addr_t dma_addr,
pgoff_t offset, pgoff_t num, dma_pfn_t dpfns[]);
I figure, for most if not all architectures we could use an ordinary pfn
as dma_pfn_t, but the dma layer would still have control over how those
pfns are obtained and how they are used in the kernel's mapping APIs.
If so, I could start looking at this, time permitting, for the cases
where the pfn can be obtained from the kernel address or from
arch_dma_coherent_to_pfn(), and also the needed work to have a tailored
vmap_pfn().
Thanks,
/Thomas
next reply other threads:[~2019-10-08 12:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-08 12:34 Thomas Hellström (VMware) [this message]
2019-10-21 12:26 ` dma coherent memory user-space maps Thomas Hellström (VMware)
2019-10-23 4:04 ` Christoph Hellwig
2019-10-31 21:54 ` Christoph Hellwig
2019-11-04 6:38 ` Thomas Hellström (VMware)
2019-11-04 6:58 ` Thomas Hellström (VMware)
2019-11-04 11:29 ` Koenig, Christian
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=b811f66d-2353-23c6-c9fa-e279cdb0f832@shipmail.org \
--to=thomas_os@shipmail.org \
--cc=christian.koenig@amd.com \
--cc=hch@infradead.org \
--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).