From: Samiullah Khawaja <skhawaja@google.com>
To: Will Deacon <will@kernel.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Mike Rapoport <rppt@kernel.org>,
Pratyush Yadav <pratyush@kernel.org>,
Alexander Graf <graf@amazon.com>,
Robin Murphy <robin.murphy@arm.com>,
Kevin Tian <kevin.tian@intel.com>,
iommu@lists.linux.dev, kexec@lists.infradead.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
David Matlack <dmatlack@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Pranjal Shrivastava <praan@google.com>,
Vipin Sharma <vipinsh@google.com>
Subject: Re: [RFC PATCH 3/4] dma-direct: Add API to preserve/restore allocations
Date: Tue, 2 Jun 2026 20:14:37 +0000 [thread overview]
Message-ID: <ah8srv7dvO4OIii8@google.com> (raw)
In-Reply-To: <ah18hDhjSLxIvb-Y@willie-the-truck>
On Mon, Jun 01, 2026 at 01:35:16PM +0100, Will Deacon wrote:
>On Tue, May 05, 2026 at 12:27:36AM +0000, Samiullah Khawaja wrote:
>> diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
>> index ec887f443741..c2b98f91900a 100644
>> --- a/kernel/dma/direct.c
>> +++ b/kernel/dma/direct.c
>> @@ -6,6 +6,8 @@
>> */
>> #include <linux/memblock.h> /* for max_pfn */
>> #include <linux/export.h>
>> +#include <linux/kexec_handover.h>
>> +#include <linux/kho/abi/dma_alloc.h>
>> #include <linux/mm.h>
>> #include <linux/dma-map-ops.h>
>> #include <linux/scatterlist.h>
>> @@ -307,6 +309,167 @@ void *dma_direct_alloc(struct device *dev, size_t size,
>> return NULL;
>> }
>>
>> +#ifdef CONFIG_DMA_LIVEUPDATE
>> +int dma_direct_preserve_allocation(struct device *dev, void *cpu_addr,
>> + size_t size, dma_addr_t dma_handle,
>> + unsigned long attrs, u64 *state)
>> +{
>> + struct dma_alloc_ser *ser;
>> + int ret;
>> +
>> + if (!kho_is_enabled())
>> + return -EOPNOTSUPP;
>> +
>> + if (IS_ENABLED(CONFIG_DMA_CMA))
>> + return -EOPNOTSUPP;
>
>Hmm, it seems a bit overkill to do this just because CMA is compiled
>in, especially as it's user-selectable in kconfig.
>
>Maybe you need to iterate over the CMA areas using cma_for_each_area(),
>similarly to how you do with the pools?
Agreed. So basically return error if the range belongs to one of the
CMAs. I will update this.
>
>Will
next prev parent reply other threads:[~2026-06-02 20:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 0:27 [RFC PATCH 0/4] dma-mapping: Add preservation of direct allocations Samiullah Khawaja
2026-05-05 0:27 ` [RFC PATCH 1/4] dma: Add DMA allocation preservation KHO ABI Samiullah Khawaja
2026-05-05 0:27 ` [RFC PATCH 2/4] dma/pool: Add an API to check if DMA allocation is from pool Samiullah Khawaja
2026-05-05 0:27 ` [RFC PATCH 3/4] dma-direct: Add API to preserve/restore allocations Samiullah Khawaja
2026-06-01 12:35 ` Will Deacon
2026-06-02 20:14 ` Samiullah Khawaja [this message]
2026-05-05 0:27 ` [RFC PATCH 4/4] dma-mapping: Add API to preserve/restore DMA allocation Samiullah Khawaja
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=ah8srv7dvO4OIii8@google.com \
--to=skhawaja@google.com \
--cc=akpm@linux-foundation.org \
--cc=dmatlack@google.com \
--cc=graf@amazon.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=kevin.tian@intel.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=pasha.tatashin@soleen.com \
--cc=praan@google.com \
--cc=pratyush@kernel.org \
--cc=robin.murphy@arm.com \
--cc=rppt@kernel.org \
--cc=vipinsh@google.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