[RFC PATCH v2 03/10] dma: contiguous: Add API to check if an allocation is from CMA

Samiullah Khawaja skhawaja at google.com
Wed Jul 15 12:58:57 PDT 2026


On Wed, Jul 15, 2026 at 09:21:16AM +0300, Leon Romanovsky wrote:
>On Wed, Jul 08, 2026 at 11:48:47PM +0000, Samiullah Khawaja wrote:
>> Add an API that uses cma_for_each() to check whether a DMA allocation is
>> from a CMA region.
>>
>> Signed-off-by: Samiullah Khawaja <skhawaja at google.com>
>> ---
>>  include/linux/dma-map-ops.h |  6 ++++++
>>  kernel/dma/contiguous.c     | 24 ++++++++++++++++++++++++
>>  2 files changed, 30 insertions(+)
>
><...>
>
>>  #ifdef CONFIG_DMA_DECLARE_COHERENT
>> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
>> index 03f52bd17120..0b1702bf39ca 100644
>> --- a/kernel/dma/contiguous.c
>> +++ b/kernel/dma/contiguous.c
>> @@ -130,6 +130,30 @@ struct cma *dev_get_cma_area(struct device *dev)
>>  }
>>  EXPORT_SYMBOL_GPL(dev_get_cma_area);
>>
>> +struct dma_cma_check_data {
>> +	phys_addr_t start;
>> +	phys_addr_t end;
>> +};
>
>If this series is retried, use "struct phys_vec" here instead of
>declaring a new structure:
>https://elixir.bootlin.com/linux/v7.1.3/source/include/linux/types.h#L173

Sure this sounds great.
>
>Thanks.

Sami



More information about the kexec mailing list