Received: by 2002:ab2:7a09:0:b0:1f8:46dc:890e with SMTP id k9csp29189lqo; Wed, 15 May 2024 06:57:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW6Yr76B8JP5zhJC8/ej3gSwOmwYns4zMi4bfEnG9zSBWwRjfjWI4cN6YvDzutjYrxmEovOvBB/z3PmJV8ufhU1i6QvhXPiclbocBUrMA== X-Google-Smtp-Source: AGHT+IEKDrHpGJ9z6SXgNxsyeEg8NVxOXq+a+Vsp/a+zv3aEfapdSkA88Q5ylWXaQq/tlzqJziU2 X-Received: by 2002:a17:906:4f08:b0:a58:725b:a021 with SMTP id a640c23a62f3a-a5a2d54c467mr915826466b.15.1715781474476; Wed, 15 May 2024 06:57:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715781474; cv=pass; d=google.com; s=arc-20160816; b=GEGiJAR53KMVO3EeY8l0j9gGIom6hOCFj9FLkLRxZkY/wNkheHv4MEl/dE0ffaYleb GD/6WIlgjUzvgTeVECWcLPTwWtD/e6Lr6H4P8WcuPhOvPiOUhspSA41x62fvDYLKY7+8 OTd3c3pNIMDjqbyWMjcUWuc0KnH27jSYelxj0U/wgc3Lg3w+0DUWHEh7KItgTyQUkmqm qZGZ0vbHdTeB7d8QEMmr09V8hOHrg3PemtGbWxOFBeDawTnNFwp6WQ9XyeV2zCRZm7mk oDo8e48hq3DH80CDTgLos+rIUyYxJ6i8Fll9M6Ef17QZ93qff8toLl5tNPQW1fRgxY6q CvxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=pRCjkZIGoHMtS8Kr4/0q8GIQQScrESPxNnSMVFyrOEM=; fh=oKXp7eYw+ueF/PASYm8o1QMj1RprGGi2Ykngp1NB+LU=; b=FabzD2UifLHF5SaYrC2/yHEfdIRFZIfPNnykyrMg5z42NewwFwCCkTFCgD8X7o9MVw qXN+tHi9T8nGiQIL4o5pqbVmmMyoUoYrgLWAjHncc0vRV03lNN3y7egix5nYm07rWUrv wty1u21ty5eqSls2JOBdmAxCwuDM+8J4C2EexLkCkV15YgP844DwDIiov+adCKSplpx+ 93UsrXAChcfJSzU7GBe1YoIopCFS1OKpnSxLKbyN86dzKanIMNbDMeENLGYQMZDYVkn7 tj7wsgMv+Il6Y688aShjLaUrIivUeQBUrjAgfpccoZMObAaMdLSXWWKtc/uoZRMbu8w1 TLsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=efVBkvUH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179952-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179952-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a1794691esi747572466b.57.2024.05.15.06.57.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 06:57:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179952-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=efVBkvUH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179952-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179952-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 157BB1F23E58 for ; Wed, 15 May 2024 13:57:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFC0013F427; Wed, 15 May 2024 13:57:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="efVBkvUH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF39564CFC; Wed, 15 May 2024 13:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715781462; cv=none; b=owzGd6nCFo01V7F4cXOW7IXZki1wDxFSTyBrCyX7HRCJc2cH+GjUReRoO+I6v4RhAe9FDYI6UU5Ai7vc1WHlwBKJpvfKuvIB5UbgxNNEGgQr5AggyHQdAHVkUYeHFJ1vlUi8HFwA+L8DluSXn+ag3yT+NU62p6CunXVkcp0F/ZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715781462; c=relaxed/simple; bh=0Om0EsLkpFBVKkvz9olitc46qsiUdNn1/n5ZWkf37uM=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=TBABM0fYwaENUMPvXAAN5Zr++U6jxKSe8rw6OFcQoGP3xpRzISCRJ+dmr8sFh/wkqV3v0jjO7UeMYhrg+wKR8Hf5mZKGs9w/mYQm9Uc2e7dsEe6BTqPnHHUNOL3u9SYwYN7mrqgre6YzZLlEuhQKKvx3f74iXqjLEK+tLW9TGQk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=efVBkvUH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 029F0C116B1; Wed, 15 May 2024 13:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715781461; bh=0Om0EsLkpFBVKkvz9olitc46qsiUdNn1/n5ZWkf37uM=; h=From:Subject:Date:To:Cc:From; b=efVBkvUHMwvEPS9v5viutvHv7Nwmm+sJx1bgg68pjDdL5tQOBfNrGoz42YlvUCiAj kn9/Q2v6QxgRiNb+6xYMD68qCd3reid6n/aqHUK1/+u2URPhCIsEV/12vnr3ycQvhH 0X615sQhaDfm/PRn0AnpVG2lmlq4fRLOXY2gH6Yal52hYHSmyhf+K+pMjXbHKAP6/u CnZ59ZBD4F6zQ+ImRB82ZBpf4m/Is/rzzkq/FbSk/XwB7v0qyM3VAREipiMF3oxUIk hZJcPiSda5+9Wpt+dsWVmhoHvv5Ce8HWDlr5HjCVBPxAidyY1xdcYyuZosqcDBUqa5 bW1opPrItcBIA== From: Maxime Ripard Subject: [PATCH 0/8] dma-buf: heaps: Support carved-out heaps and ECC related-flags Date: Wed, 15 May 2024 15:56:55 +0200 Message-Id: <20240515-dma-buf-ecc-heap-v1-0-54cbbd049511@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIACe/RGYC/x3MQQqAIBBA0avIrBtIS6iuEi1Mx5pFJkoRhHdPW r7F/y9kSkwZJvFCopszn6FCNgLsbsJGyK4aVKv6VkuN7jC4Xh7JWtzJRFSD6aR0yo49Qc1iIs/ Pv5yXUj7AlIV2YgAAAA== To: Rob Herring , Saravana Kannan , Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , =?utf-8?q?Christian_K=C3=B6nig?= Cc: Mattijs Korpershoek , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Maxime Ripard X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2381; i=mripard@kernel.org; h=from:subject:message-id; bh=0Om0EsLkpFBVKkvz9olitc46qsiUdNn1/n5ZWkf37uM=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDGku+50Tp5XnH/PUiwzWiHWN5qhb6TVvj+JzU9WQlR+vH hINFfXtmMrCIMzJICumyPJEJuz08vbFVQ72K3/AzGFlAhnCwMUpABO5OZWxzoZzzf/AWs7XRS8b b2ve+P/28/yayTKc7TP4yu8EKcs9T/BblnA2Ni96fpTEgzBOSf0PjA0bdl68zBtx8n3vjmrdCjb 5sNayFR9yDVdVeth++TrprFWp9qWS08IBj13Lo87oGvAt+QUA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Hi, This series is the follow-up of the discussion that John and I had a few months ago here: https://lore.kernel.org/all/CANDhNCquJn6bH3KxKf65BWiTYLVqSd9892-xtFDHHqqyrroCMQ@mail.gmail.com/ The initial problem we were discussing was that I'm currently working on a platform which has a memory layout with ECC enabled. However, enabling the ECC has a number of drawbacks on that platform: lower performance, increased memory usage, etc. So for things like framebuffers, the trade-off isn't great and thus there's a memory region with ECC disabled to allocate from for such use cases. After a suggestion from John, I chose to start using heap allocations flags to allow for userspace to ask for a particular ECC setup. This is then backed by a new heap type that runs from reserved memory chunks flagged as such, and the existing DT properties to specify the ECC properties. We could also easily extend this mechanism to support more flags, or through a new ioctl to discover which flags a given heap supports. I submitted a draft PR to the DT schema for the bindings used in this PR: https://github.com/devicetree-org/dt-schema/pull/138 Let me know what you think, Maxime Signed-off-by: Maxime Ripard --- Maxime Ripard (8): dma-buf: heaps: Introduce a new heap for reserved memory of: Add helper to retrieve ECC memory bits dma-buf: heaps: Import uAPI header dma-buf: heaps: Add ECC protection flags dma-buf: heaps: system: Remove global variable dma-buf: heaps: system: Handle ECC flags dma-buf: heaps: cma: Handle ECC flags dma-buf: heaps: carveout: Handle ECC flags drivers/dma-buf/dma-heap.c | 4 + drivers/dma-buf/heaps/Kconfig | 8 + drivers/dma-buf/heaps/Makefile | 1 + drivers/dma-buf/heaps/carveout_heap.c | 330 ++++++++++++++++++++++++++++++++++ drivers/dma-buf/heaps/cma_heap.c | 10 ++ drivers/dma-buf/heaps/system_heap.c | 29 ++- include/linux/dma-heap.h | 2 + include/linux/of.h | 25 +++ include/uapi/linux/dma-heap.h | 5 +- 9 files changed, 407 insertions(+), 7 deletions(-) --- base-commit: a38297e3fb012ddfa7ce0321a7e5a8daeb1872b6 change-id: 20240515-dma-buf-ecc-heap-28a311d2c94e Best regards, -- Maxime Ripard