Thread (39 messages) 39 messages, 8 authors, 9d ago

Re: [RFC PATCH v7 12/13] dma-buf: system_heap: Allocate shared buffers using CoCo shared memory allocator

From: Christian König <christian.koenig@amd.com>
Date: 2026-09-23 08:46:45
Also in: dri-devel, kvmarm, linux-coco, linux-iommu, linux-media, linux-mm, lkml

On 9/23/26 10:32, Aneesh Kumar K.V wrote:
Catalin Marinas [off-list ref] writes:
quoted
On Mon, Sep 21, 2026 at 08:18:46PM +0530, Aneesh Kumar K.V (Arm) wrote:
quoted
@@ -405,6 +396,7 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
 {
 	struct system_heap_buffer *buffer;
 	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
+	struct cc_shared_layout layout;
 	unsigned long size_remaining = len;
 	unsigned long sg_remaining = len;
 	unsigned int max_order = orders[0];
@@ -417,6 +409,14 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
 	struct page *page, *tmp_page;
 	int i, ret = -ENOMEM;
 
+	if (cc_shared) {
+		ret = cc_shared_calc_layout(len, &layout);
You should not override 'ret' here, it was set to -ENOMEM for a reason.
cc_shared_calc_layout() succeeds resetting 'ret' and some further down
allocation failure, goto free will return ERR_PTR(0).

Agreed. I’ll fix this in the next revision.
Please CC me on that as well, I will try to find time to take a look.

Regards,
Christian.
-aneesh
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help