From: Chris Leech <cleech@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Christoph Hellwig <hch@lst.de>, Rasesh Mody <rmody@marvell.com>,
Ariel Elior <aelior@marvell.com>,
Sudarsana Kalluru <skalluru@marvell.com>,
Manish Chopra <manishc@marvell.com>,
Nilesh Javali <njavali@marvell.com>,
Manish Rangankar <mrangankar@marvell.com>,
Jerry Snitselaar <jsnitsel@redhat.com>,
John Meneghini <jmeneghi@redhat.com>,
Lee Duncan <lduncan@suse.com>,
Mike Christie <michael.christie@oracle.com>,
Hannes Reinecke <hare@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] uio: introduce UIO_DMA_COHERENT type
Date: Sat, 30 Sep 2023 11:08:39 -0700 [thread overview]
Message-ID: <ZRhj+GtzkCGWyylI@rhel-developer-toolbox> (raw)
In-Reply-To: <2023093037-onion-backroom-b4ef@gregkh>
On Sat, Sep 30, 2023 at 09:10:10AM +0200, Greg Kroah-Hartman wrote:
> On Fri, Sep 29, 2023 at 10:00:21AM -0700, Chris Leech wrote:
> > Add a UIO memtype specificially for sharing dma_alloc_coherent
> > memory with userspace, backed by dma_mmap_coherent.
>
> Are you sure that you can share this type of memory with userspace
> safely? And you are saying what you are doing here, but not why you
> want to do it and who will use it.
>
> What are the userspace implications for accessing this type of memory?
Thanks for taking the time to look at this Greg.
I'm trying to help Marvell fix a regression with these drivers, by
figuring out what the right way to handle this type of mmap is.
The dma_mmap_coherent API exists for exactly this, so I thought making
the uio interface aware of it made sense. There are uio drivers sharing
dma_alloc_coherent memory (uio_dmem_genirq, uio_pruss) using
UIO_MEM_PHYS, but that falls apart in the face of an iommu.
> > struct uio_mem {
> > const char *name;
> > - phys_addr_t addr;
> > + union {
> > + phys_addr_t addr;
> > + dma_addr_t dma_addr;
> > + };
> > unsigned long offs;
> > resource_size_t size;
> > int memtype;
> > - void __iomem *internal_addr;
> > + union {
> > + void __iomem *internal_addr;
> > + void *virtual_addr;
> > + };
> > + struct device *dma_device;
>
> Why are you adding a new struct device here?
dma_mmap_coherent wants it.
> And why the unions? How are you going to verify that they are being
> used correctly? What space savings are you attempting to do here and
> why?
I should have expected that would be questioned, I was being paranoid
about mixing different pointer and address types. I can remove the
unions if putting a dma_addr_t in addr going to be OK.
- Chris
next prev parent reply other threads:[~2023-09-30 18:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 17:00 [PATCH 0/3] UIO_MEM_DMA_COHERENT for cnic/bnx2/bnx2x Chris Leech
2023-09-29 17:00 ` [PATCH 1/3] uio: introduce UIO_DMA_COHERENT type Chris Leech
2023-09-30 7:10 ` Greg Kroah-Hartman
2023-09-30 18:08 ` Chris Leech [this message]
2023-10-02 6:09 ` Christoph Hellwig
2023-09-29 17:00 ` [PATCH 2/3] cnic,bnx2,bnx2x: page align uio mmap allocations Chris Leech
2023-09-29 17:18 ` Jacob Keller
2023-10-02 6:11 ` Christoph Hellwig
2023-09-29 17:00 ` [PATCH 3/3] cnic,bnx2,bnx2x: use UIO_MEM_DMA_COHERENT Chris Leech
2023-09-29 17:19 ` Jacob Keller
2023-09-30 7:06 ` Greg Kroah-Hartman
2023-09-30 9:10 ` Jerry Snitselaar
2023-09-30 18:29 ` Greg Kroah-Hartman
2023-09-30 18:19 ` Chris Leech
2023-09-30 18:28 ` Greg Kroah-Hartman
2023-10-01 10:44 ` Hannes Reinecke
2023-10-01 11:57 ` Greg Kroah-Hartman
2023-10-01 14:22 ` Jerry Snitselaar
2023-10-02 6:04 ` Christoph Hellwig
2023-10-02 7:50 ` Jerry Snitselaar
2023-10-02 8:46 ` Greg Kroah-Hartman
2023-10-02 8:59 ` Hannes Reinecke
2023-10-05 10:39 ` Paolo Abeni
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=ZRhj+GtzkCGWyylI@rhel-developer-toolbox \
--to=cleech@redhat.com \
--cc=aelior@marvell.com \
--cc=gregkh@linuxfoundation.org \
--cc=hare@kernel.org \
--cc=hch@lst.de \
--cc=jmeneghi@redhat.com \
--cc=jsnitsel@redhat.com \
--cc=lduncan@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manishc@marvell.com \
--cc=michael.christie@oracle.com \
--cc=mrangankar@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=njavali@marvell.com \
--cc=rmody@marvell.com \
--cc=skalluru@marvell.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;
as well as URLs for NNTP newsgroup(s).