Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp118472lqk; Wed, 13 Mar 2024 19:18:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKuKQK+tv3EPgwqMO8I1RIqNrOSj2xBc2PCKjdspafJaW5000Q9rP+a1miqsjSyKkAjWr4LkgrJDYdapcFKlsWgnDeDIZQ850lf1dL7g== X-Google-Smtp-Source: AGHT+IGxAMjwCRrD2oVs6cB1HfHdVnKFsyWA8xm99zeHrsluXh/LlQl9iPvGIXe1RZ96N2Q/e73t X-Received: by 2002:a17:902:e848:b0:1db:c390:1fdc with SMTP id t8-20020a170902e84800b001dbc3901fdcmr801920plg.1.1710382722669; Wed, 13 Mar 2024 19:18:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710382722; cv=pass; d=google.com; s=arc-20160816; b=HnehXq00vCco5bdZsOG8v+uxUlfQeP+RkfXopIjzMQ1xYuLzhW1DNOPiHSbRY68gPe FHXuWPnGtVAtLaqojxKlppJXPE/Nipkq1XodoSp9Q+rBM5/9wOAQeni+IJ/jOKCrQ2Jy suq2ZVPFPla7DitdzheO/ipjLsdbrtG0rGlPw/cYU4UFI0HW/ZaLybMC+XAj+xf7WJDy GukuLVdietWdwtzKngdtJpzJvZwHZUYYW2XNS8otlC2naxLmF5d90C9Yu9PnWf0bRJEr 6vocHV+YCDLmX8ta80v6dSdc/PXhsNx2Au26QjAxDngxdJVBknJ+ONafrt4COjq1SXl8 FFHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NMXxgYFB39c3JQb86pcYzX4ejK9UB61sydOSCe9B0SI=; fh=evdHaAalQd4qIOqm+fzmi0zVQ9Db4lHLQDWT9WfNyFU=; b=ffgdoQoryuiIp7rQfluyxtFZCadRHMb3VD4GYNK/ZfZywATzxf/GQrJ4jGvEAf1Gfm iBHPYsG/UsjXnGodJ9bFwG0d8zS3uZ02Ll5/3Jl111XIqvcmFTCQnE7Hc+LhBf1I74uU 7vAfaSbK4KCv8XBZcRXuY4ql0QFg2CcePpFO66xIDLWuJ07DoYfooNaj1rXoqLnundoA SKvCGigUEVej2FF9sTv/HD0Oc41Zr2oXEmkTpxoFNGXcpzoTOysZLfmG9k2o/6Gh/2gm UIR1QYeAX1i++eJiUUwaRDvPEoQvxeg8zxpgjbEP94qPOymxRfvF9YdOUjGxKQSXMUK8 eTZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KUNWi+v1; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-102712-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102712-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n6-20020a170903110600b001ddb681994csi499039plh.558.2024.03.13.19.18.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 19:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102712-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KUNWi+v1; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-102712-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102712-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 559452871A7 for ; Thu, 14 Mar 2024 02:18:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96E4B46A0; Thu, 14 Mar 2024 02:18:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KUNWi+v1" Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FFE04A0F for ; Thu, 14 Mar 2024 02:18:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710382715; cv=none; b=DdpvQr+6SJtbaNCPhhim4c8KWtnGGQAY/iebbw+2mRztPWTgi11GqMHTWLCeT8vXFr2Y42CmZsNk3blNANBDyjmC5I3/Kq5QESsKf7r3YdsRVKXhpDfhW2ragD7P5IVoq9DQGItaxXYsv4B1Man//otQIQY/Q+GXGljp6KkSO1w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710382715; c=relaxed/simple; bh=g7vEnho4KgVqd3zIlFIhWB3dU3UC1oJopzBuAznghs0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Jsr/42Tc78OMps/AuNalU9Ew14ZmwVXZM+NN7mbXHqopG11LBJcBvAaT2z0nLwd6RQL3rYg4KEAN37+wX2KTelH8+gj3aSRYHXXHM2p6PRFeJfIwlEo/E2o5mS6hCmX9QYlDEZ2RSv324O+HHlzzhqLB6YMk0Wq/gdCt1DOaGL8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=KUNWi+v1; arc=none smtp.client-ip=209.85.215.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-5e152c757a5so259412a12.2 for ; Wed, 13 Mar 2024 19:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710382713; x=1710987513; darn=vger.kernel.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=NMXxgYFB39c3JQb86pcYzX4ejK9UB61sydOSCe9B0SI=; b=KUNWi+v16FOSGVjQIJz2I3O4Ua+xysDllewL/bJ4PLEgNIz8F5InacyakaalbBFmvx ejXVfCyKiAXvfCZcrOzFlkrCF/5ESlGz9okbhYX7l8c3uXCvWeQ9sVrH1T4Kd1z/8PrT Nr9qYOYsn/4FvKU+EA7630srBpkGZlR/fpiQg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710382713; x=1710987513; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NMXxgYFB39c3JQb86pcYzX4ejK9UB61sydOSCe9B0SI=; b=AX4+6rTPPfVrZOVwai7KhgSGbWfSZVZDxqBOPyx3GH2lsX+QSe1XzQm4mNCMSobZEY WRKtDgkNRBjVHotj4Dot+ouAA9ZODLIAPr5kFBHtVFNvlpfYo0eSTtDfR8U79Q0Rsq3N aBFSaE5gLY1h9VY4xB9lNT30+eZm/HZPXTl13R+BK0bpcUr0qLK4TdIILAIkZ9R47tPk 9j6WKpaE3jNckRd+PD6diCkRwQDngZcR4plWoDO+k3gcyqdFy8XRG6NXif8viEJ8QfuR W5mpwNYBY2/CR6tjKpKf2o4vD6wLVUbMAovxZ+YZaaJW5oFxq11hg7gKsKRyburhtMzr TOaw== X-Forwarded-Encrypted: i=1; AJvYcCU5dWoDiOGP/+29k8ZRvxKCeY4dC21FDt+jUoICwupMxHJnZn09YtMG+9nd5g9K9f7KE2ZG1Be/ZjSfIYOlxHTdrdfctfc+ZOGaNdOC X-Gm-Message-State: AOJu0YwBnL43ia/FmcChVxcINyzlA36ybrWB2ooWxz4bC7lTeX7xWQcK A8N9RIHAB6AvaJ6NZflGqlSKNwD422kTDoSd+GzUT2NLNYSuK7ug03kl3JsyWw== X-Received: by 2002:a17:90a:f288:b0:29a:caf9:de64 with SMTP id fs8-20020a17090af28800b0029acaf9de64mr414882pjb.40.1710382713471; Wed, 13 Mar 2024 19:18:33 -0700 (PDT) Received: from chromium.org ([118.149.82.233]) by smtp.gmail.com with ESMTPSA id o1-20020a17090aac0100b0029bc25f7181sm1993937pjq.54.2024.03.13.19.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 19:18:33 -0700 (PDT) From: Simon Glass To: devicetree@vger.kernel.org Cc: Miquel Raynal , Michael Walle , Rob Herring , linux-mtd@lists.infradead.org, Simon Glass , Conor Dooley , Krzysztof Kozlowski , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Richard Weinberger , Rob Herring , Vignesh Raghavendra , linux-kernel@vger.kernel.org Subject: [PATCH v7 2/2] dt-bindings: mtd: fixed-partitions: Add alignment properties Date: Thu, 14 Mar 2024 15:17:54 +1300 Message-Id: <20240314021754.84557-2-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240314021754.84557-1-sjg@chromium.org> References: <20240314021754.84557-1-sjg@chromium.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: 8bit Add three properties for controlling alignment of partitions, aka 'entries' in fixed-partition. For now there is no explicit mention of hierarchy, so a 'section' is just the 'fixed-partitions' node. These new properties are inputs to the Binman packaging process, but are also needed if the firmware is repacked, to ensure that alignment constraints are not violated. Therefore they are provided as part of the schema. Signed-off-by: Simon Glass --- Changes in v7: - Drop patch 'Add binman compatible' - Put the alignment properties into the fixed-partition binding Changes in v6: - Correct schema-validation errors missed due to older dt-schema (enum fix and reg addition) Changes in v5: - Add value ranges - Consistently mention alignment must be power-of-2 - Mention that alignment refers to bytes Changes in v2: - Fix 'a' typo in commit message .../bindings/mtd/partitions/partition.yaml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml index 1ebe9e2347ea..3df12df06116 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml @@ -57,6 +57,57 @@ properties: user space from type: boolean + align: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 0x80000000 + multipleOf: 2 + description: + This sets the alignment of the entry in bytes. + + The entry offset is adjusted so that the entry starts on an aligned + boundary within the containing section or image. For example ‘align = + <16>’ means that the entry will start on a 16-byte boundary. This may + mean that padding is added before the entry. The padding is part of + the containing section but is not included in the entry, meaning that + an empty space may be created before the entry starts. Alignment + must be a power of 2. If ‘align’ is not provided, no alignment is + performed. + + align-size: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 0x80000000 + multipleOf: 2 + description: + This sets the alignment of the entry size in bytes. It must be a power + of 2. + + For example, to ensure that the size of an entry is a multiple of 64 + bytes, set this to 64. While this does not affect the contents of the + entry within binman itself (the padding is performed only when its + parent section is assembled), the end result is that the entry ends + with the padding bytes, so may grow. If ‘align-size’ is not provided, + no alignment is performed. + + align-end: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 0x80000000 + multipleOf: 2 + description: + This sets the alignment (in bytes) of the end of an entry with respect + to the containing section. It must be a power of 2. + + Some entries require that they end on an alignment boundary, + regardless of where they start. This does not move the start of the + entry, so the contents of the entry will still start at the beginning. + But there may be padding at the end. While this does not affect the + contents of the entry within binman itself (the padding is performed + only when its parent section is assembled), the end result is that the + entry ends with the padding bytes, so may grow. If ‘align-end’ is not + provided, no alignment is performed. + if: not: required: [ reg ] @@ -67,3 +118,24 @@ then: # This is a generic file other binding inherit from and extend additionalProperties: true + +examples: + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@100000 { + compatible = "u-boot"; + reg = <0x100000 0xf00000>; + align-size = <0x1000>; + align-end = <0x10000>; + }; + + partition@200000 { + compatible = "tfa-bl31"; + reg = <0x200000 0x100000>; + align = <0x4000>; + }; + }; -- 2.34.1