All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Howard Yen <howardyen@google.com>,
	hch@lst.de, m.szyprowski@samsung.com,
	andriy.shevchenko@linux.intel.com, petr.tesarik.ext@huawei.com,
	rafael@kernel.org, broonie@kernel.org, james@equiv.tech,
	james.clark@arm.com, masahiroy@kernel.org,
	linux-kernel@vger.kernel.org, iommu@lists.linux.dev
Subject: Re: [PATCH] dma-coherent: add support for multi coherent rmems per dev
Date: Thu, 1 Feb 2024 07:41:31 -0800	[thread overview]
Message-ID: <2024020156-reshuffle-salvaging-8161@gregkh> (raw)
In-Reply-To: <f5b626ae-bda1-479f-bc14-b1fd7ba043cf@arm.com>

On Thu, Feb 01, 2024 at 10:45:30AM +0000, Robin Murphy wrote:
> On 2024-02-01 9:35 am, Howard Yen wrote:
> > Add support for multiple coherent rmems per device. This patch addes
> > dma_mem_list to device structure to store multiple rmems.
> > 
> > These multiple rmems can be assigned to the device one by one by
> > of_reserved_mem_device_init_by_idx() with the memory-region
> > declaration in device tree as below and store the rmem to the dma_mem_list.
> > 
> > 	device1@0 {
> > 		...
> > 		memory-region = <&reserved_mem0>, <&reserved_mem1>;
> > 		...
> > 	};
> > 
> > When driver tries to allocate memory from the rmems, looks for the first
> > available rmem and allocates the memory from this rmem.
> > 
> > Then if driver removed, of_reserved_mem_device_release() needs to be
> > invoked to release all the rmems assigned to the device.
> > 
> > Signed-off-by: Howard Yen <howardyen@google.com>
> > ---
> >   include/linux/device.h |  1 +
> >   kernel/dma/coherent.c  | 66 +++++++++++++++++++++++++++++++++++-------
> >   2 files changed, 56 insertions(+), 11 deletions(-)
> > 
> > diff --git a/include/linux/device.h b/include/linux/device.h
> > index 97c4b046c09d..c8682ee507cf 100644
> > --- a/include/linux/device.h
> > +++ b/include/linux/device.h
> > @@ -751,6 +751,7 @@ struct device {
> >   #ifdef CONFIG_DMA_DECLARE_COHERENT
> >   	struct dma_coherent_mem	*dma_mem; /* internal for coherent mem
> >   					     override */
> > +	struct list_head	dma_mem_list;
> 
> I'm not necessarily against the idea, but only if it's implemented sensibly.
> If we're going to have a list of these it should *replace* the existing
> pointer, not do this weird thing with both.

Agreed, it should be one pointer max for this structure for this type of
thing.  Why not move it into the dma_coherent_mem structure?

thanks,

greg k-h

  parent reply	other threads:[~2024-02-01 15:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01  9:35 [PATCH] dma-coherent: add support for multi coherent rmems per dev Howard Yen
2024-02-01 10:45 ` Robin Murphy
2024-02-01 11:45   ` Andy Shevchenko
2024-02-01 15:41   ` Greg KH [this message]
2024-02-02  4:40     ` Howard Yen
2024-02-02 15:09       ` Andy Shevchenko

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=2024020156-reshuffle-salvaging-8161@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=hch@lst.de \
    --cc=howardyen@google.com \
    --cc=iommu@lists.linux.dev \
    --cc=james.clark@arm.com \
    --cc=james@equiv.tech \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=masahiroy@kernel.org \
    --cc=petr.tesarik.ext@huawei.com \
    --cc=rafael@kernel.org \
    --cc=robin.murphy@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.