The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Mostafa Saleh <smostafa@google.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	robin.murphy@arm.com, m.szyprowski@samsung.com, will@kernel.org,
	maz@kernel.org, suzuki.poulose@arm.com, jiri@resnulli.us,
	aneesh.kumar@kernel.org
Subject: Re: [RFC PATCH v3 4/5] dma-mapping: Encapsulate memory state during allocation
Date: Thu, 7 May 2026 18:36:27 +0100	[thread overview]
Message-ID: <afzNm6ZmR6c8_SMk@arm.com> (raw)
In-Reply-To: <aeJVh5VbkzxHDBEK@google.com>

On Fri, Apr 17, 2026 at 03:45:11PM +0000, Mostafa Saleh wrote:
> On Fri, Apr 10, 2026 at 03:05:04PM -0300, Jason Gunthorpe wrote:
> > On Wed, Apr 08, 2026 at 07:47:41PM +0000, Mostafa Saleh wrote:
> > > Introduce a new dma-direct internal type dma_page which is
> > > "struct page" and a bit indicate whether the memory has been decrypted
> > > or not.
> > > This is useful to pass such information encapsulated through
> > > allocation functions, which is currently set from swiotlb_alloc().
> > > 
> > > No functional changes.
> > > 
> > > Signed-off-by: Mostafa Saleh <smostafa@google.com>
> > > ---
> > >  kernel/dma/direct.c | 58 +++++++++++++++++++++++++++++++++++----------
> > >  1 file changed, 46 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
> > > index de63e0449700..204bc566480c 100644
> > > --- a/kernel/dma/direct.c
> > > +++ b/kernel/dma/direct.c
> > > @@ -16,6 +16,33 @@
> > >  #include <linux/pci-p2pdma.h>
> > >  #include "direct.h"
> > >  
> > > +/*
> > > + * Represent DMA allocation and 1 bit flag for it's state
> > > + */
> > 
> > I'd explain this wrappers a pointer and uses the low PAGE_SHIFT bits
> > for flags..
> > 
> > > +struct dma_page {
> > > +	unsigned long val;
> > 
> > unintptr_t ?
> 
> I thought about that, but I don’t see unintptr_t anywhere in the
> kernel, it seems similar cases use “unsigned long” as in xarray.h

Jason meant uintptr_t. However, we have a similar pattern with struct
encoded_page as an incomplete type and encode_page() adds the bits
directly to the pointer. I'd use something similar as there's precedent
already.

-- 
Catalin

  parent reply	other threads:[~2026-05-07 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260408194750.2280873-1-smostafa@google.com>
     [not found] ` <20260408194750.2280873-4-smostafa@google.com>
     [not found]   ` <yq5atstdanx8.fsf@kernel.org>
2026-05-07 17:18     ` [RFC PATCH v3 3/5] dma-mapping: Decrypt memory on remap Catalin Marinas
2026-05-08  4:03       ` Aneesh Kumar K.V
     [not found] ` <20260408194750.2280873-5-smostafa@google.com>
     [not found]   ` <20260410180504.GE2551565@ziepe.ca>
     [not found]     ` <aeJVh5VbkzxHDBEK@google.com>
2026-05-07 17:36       ` Catalin Marinas [this message]
2026-05-11 10:48         ` [RFC PATCH v3 4/5] dma-mapping: Encapsulate memory state during allocation Mostafa Saleh

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=afzNm6ZmR6c8_SMk@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=jiri@resnulli.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=maz@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=smostafa@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@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