From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 266FFE81BDB for ; Mon, 9 Feb 2026 15:38:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B2AB410E41F; Mon, 9 Feb 2026 15:38:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20230601.gappssmtp.com header.i=@resnulli-us.20230601.gappssmtp.com header.b="DC3Lr6op"; dkim-atps=neutral Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D55110E41C for ; Mon, 9 Feb 2026 15:38:16 +0000 (UTC) Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-436309f1ad7so1886378f8f.3 for ; Mon, 09 Feb 2026 07:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20230601.gappssmtp.com; s=20230601; t=1770651495; x=1771256295; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RHwHnR/AkgDNwuGXRgvil2Ov0DASjUJHIHivMAy5Dsg=; b=DC3Lr6opO/C6txBlXnyyFDvqk4MGo79IU0qkGrrGyuz0FU9dLsRLfhFGUMkGBPIUOa 8aQGQoEOoA3QtfFj6nxl5JmWFtc7+OAjVb4mt+cP9XE/JFRaTNNLh1lJLWafHS1dWjT/ FWZ1YDhVNJbVXgGi6rE+Kb7XsorW/rAWmfrkcmGEdYkj631mbLs6PaE6Atb7ihlXTs6B xfYS4Rc2voVKiETNqOwIEL1vZSNOJJI2jLlVMPzHH1v8FUebDCxH+KLE8sRGYFOJIhlo AmHK8r25wB8y5iJVG/Wmefw/eyH/wFblyV1GwzTwdPICr57DTaXp4ywt0A/MRyPHXvX+ yrzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770651495; x=1771256295; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RHwHnR/AkgDNwuGXRgvil2Ov0DASjUJHIHivMAy5Dsg=; b=EX4ZklsnHVUAhyebrnseJQbTiluR8l2BsntKC19Uv7pDiKsEy/ArpeFhtkDkxKotQE u4BBmHg13tk1aq7wdvv9JVk2aGLZzOaWFn0Vq8QIxgWVQ/qnnJlwHssUuuED/r+/+0Ce rtB5bDzc5jtn2aypOKs50R7mBGsRgWnvc70yaPZlu2o18dxly4OKrzi0FPcB2JkOKzm1 +fF3yrxCty7N7gb/bseVGYW4ZbckUzMVJw5w3xvAwUdE9/IZDei7a4YMUxMd63n3Z9Bs wvCLNSW73NT5aeGweyKSEr9if5HK9XFQ1vmpVJN0dI11+gl8xTGfHbGPYuwCEXchW/N/ VEew== X-Gm-Message-State: AOJu0YwO6nzIUCb+QlzR9S45HsLv2Y4B8FmcmLKU+B7a/2rEUbxWAXXr u/JfOX5YKH6lqRP7y4ZIH2RfxvxFijSmFJpY+IxDlzBh3wIrq2yPz9rNgu12O3n3RtjMseInAYM FPARN X-Gm-Gg: AZuq6aLIRJJwZOgqvvSFbANeUx3SS0JtBiuFxY92xS9Vwvvt1WKdDm/H/3WZaMPa+1S xxM7Zl3ZW72WYJEeQuZrI6E4QG8qqzWfCjL5U+wbSkG1XYGuF3dCX2JwKvrkmaO4FbV/5FnIPRg 4D2LsoAFSV0kWHkkVLBzokpa9eXlTaJhp4EbAafCAhJv2gUrtxw1AvQI8O2Z9r/5dLuPRgGs1y9 zRuz7z69/omGa5MSuCoHSTks5VNqCm9CSdAbIRqHnuXubxweNUDMZ56lf3DImaPfA98MYhdZpUP HT3cZkkfu70rOqA//HJQqjkGIVqrkZpoOzClH9TTPbCuYlGcLnyL7XjGVIysEkEetf8I+dktzGk pz1upk2zQQUec+MvDPeuEvD46SZlqV66rH6gF0COijfek8WiUkAiFFgIcKUKqi3NAD4SgIgAuNh kxjQ== X-Received: by 2002:a5d:5f91:0:b0:432:852d:5662 with SMTP id ffacd0b85a97d-4362938f401mr17980642f8f.63.1770651495066; Mon, 09 Feb 2026 07:38:15 -0800 (PST) Received: from localhost ([85.163.81.98]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-436296b25casm28647578f8f.4.2026.02.09.07.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Feb 2026 07:38:14 -0800 (PST) From: Jiri Pirko To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, iommu@lists.linux.dev, linux-media@vger.kernel.org Cc: sumit.semwal@linaro.org, benjamin.gaignard@collabora.com, Brian.Starkey@arm.com, jstultz@google.com, tjmercier@google.com, christian.koenig@amd.com, m.szyprowski@samsung.com, robin.murphy@arm.com, jgg@ziepe.ca, leon@kernel.org, sean.anderson@linux.dev, ptesarik@suse.com, catalin.marinas@arm.com, aneesh.kumar@kernel.org, suzuki.poulose@arm.com, steven.price@arm.com, thomas.lendacky@amd.com, john.allen@amd.com, ashish.kalra@amd.com, suravee.suthikulpanit@amd.com, linux-coco@lists.linux.dev Subject: [PATCH 4/5] dma-buf: heaps: allow heap to specify valid heap flags Date: Mon, 9 Feb 2026 16:38:08 +0100 Message-ID: <20260209153809.250835-5-jiri@resnulli.us> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20260209153809.250835-1-jiri@resnulli.us> References: <20260209153809.250835-1-jiri@resnulli.us> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Jiri Pirko Currently the flags, which are unused, are validated for all heaps. Since the follow-up patch introduces a flag valid for only one of the heaps, allow to specify the valid flags per-heap. Signed-off-by: Jiri Pirko --- drivers/dma-buf/dma-heap.c | 5 ++++- include/linux/dma-heap.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c index 8ab49924f8b7..4751bcef4b19 100644 --- a/drivers/dma-buf/dma-heap.c +++ b/drivers/dma-buf/dma-heap.c @@ -28,6 +28,7 @@ * @name: used for debugging/device-node name * @ops: ops struct for this heap * @priv: private data for this heap + * @valid_heap_flags: valid heap flags for this heap * @heap_devt: heap device node * @list: list head connecting to list of heaps * @heap_cdev: heap char device @@ -38,6 +39,7 @@ struct dma_heap { const char *name; const struct dma_heap_ops *ops; void *priv; + u64 valid_heap_flags; dev_t heap_devt; struct list_head list; struct cdev heap_cdev; @@ -105,7 +107,7 @@ static long dma_heap_ioctl_allocate(struct file *file, void *data) if (heap_allocation->fd_flags & ~DMA_HEAP_VALID_FD_FLAGS) return -EINVAL; - if (heap_allocation->heap_flags & ~DMA_HEAP_VALID_HEAP_FLAGS) + if (heap_allocation->heap_flags & ~heap->valid_heap_flags) return -EINVAL; fd = dma_heap_buffer_alloc(heap, heap_allocation->len, @@ -246,6 +248,7 @@ struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info) heap->name = exp_info->name; heap->ops = exp_info->ops; heap->priv = exp_info->priv; + heap->valid_heap_flags = exp_info->valid_heap_flags; /* Find unused minor number */ ret = xa_alloc(&dma_heap_minors, &minor, heap, diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h index 27d15f60950a..7cfb531a9281 100644 --- a/include/linux/dma-heap.h +++ b/include/linux/dma-heap.h @@ -31,6 +31,7 @@ struct dma_heap_ops { * @name: used for debugging/device-node name * @ops: ops struct for this heap * @priv: heap exporter private data + * @valid_heap_flags: valid heap flags for this heap * * Information needed to export a new dmabuf heap. */ @@ -38,6 +39,7 @@ struct dma_heap_export_info { const char *name; const struct dma_heap_ops *ops; void *priv; + u64 valid_heap_flags; }; void *dma_heap_get_drvdata(struct dma_heap *heap); -- 2.51.1