From patchwork Fri Mar 15 20:45:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1912704 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=dDTxTMX/; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=kFigFWRe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TxGVY13xJz1yWn for ; Sat, 16 Mar 2024 07:45:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=lGG6cnac0HjTgHH7EcNe1xYzOJDVj9SuiJsua/rs3Ro=; b=dDTxTMX/Gf6I57 XtvMrWK+LEvf2JJ7V6/HX42ProGj3rw4S97i9oaJab0/pGs4VoD4M2Wl2ZOmDaPBQYek/lsKlYGU9 pByxzNITPw4Z0YCg7ZNa/15dy+1+iI4Ulh73VGaLuBlZYtftAm6m5QL1bimJGxrEP/ZMKt3bdxRib pwrfk4GH/AOzNaCM59mb6l8xwU82NZ1NBwGx6Jq9gGeXNa9fTAethwlTP0RNNdsk4Ei8m875SA4Zz l6DtegxLv+3UredhTqZQavVF2MUxgeiKXVfuONH/a7SvUQeXdG9+R7eh5XNBXDJRK7wQoSoF1PDas tqebDzMJJGTihsrgFBjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rlEQt-00000001Wbz-1QPd; Fri, 15 Mar 2024 20:45:39 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rlEQn-00000001WZk-2UL9 for linux-mtd@lists.infradead.org; Fri, 15 Mar 2024 20:45:38 +0000 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-29a5f100c1aso1652817a91.0 for ; Fri, 15 Mar 2024 13:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710535532; x=1711140332; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PQYzUNy+Emf54idwje5yghrSqUUAVlujONdk1QB+Gj0=; b=kFigFWRe15FqoOtJ5C3+2Yu7t9Pm4tKOEyfrYSRhHKD4M1UnaiUhfiq2MXOhkg1Fhq aaBlYWhyFO944BgZNlO/P8/m6+CBvt0Z8SDfvKRVMFOY5aMVit+bvUDlF44h6satBnxs EWQshwfx7dbPBVNKEqkb4i0zU2/tZwPAWH1l8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710535532; x=1711140332; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PQYzUNy+Emf54idwje5yghrSqUUAVlujONdk1QB+Gj0=; b=vn3NkldmvvuWZm8Wqx0+SgtUzVe3vP4KLMZeek3N5em7Vtl3LipfhThHLcihWwc1b+ ab61iggdYwXWqefOOcYB/b7C9eYy6OSihYFaYpYgL33QZNqotTQxUsw5EEMTDu96c7Dq /TeQ1tKWHr39CroGtcryC8VhRY08+UOw3l+2m0yPzy1xP71VWnN9lKEFV6FOZbqAxpVD XSVRUgbl5B+8fh3cq/WrEDqUj1E2BriY3qDnl8NiFsTOmglAlkieWvYC1iNFjE65fVzb dvKmAv1MKAyjPwCvy67Kq0Dc/sA9wbKc1JlNoyQjU5sPGxEj82DXWTZL+eR3tDCZUlLl W7uQ== X-Gm-Message-State: AOJu0Yz+DF6GP/ZtGR0YJmaxO40EVNiPwVJagq5h0hjyFMdU5SU2UGem 0ICz0iJeQ39o+5c6V0jlIxda6eTZsIXj6aEMsbfwHgR2Q9WwZFVLUZPLtA7AfA== X-Google-Smtp-Source: AGHT+IH/pFa5YIqgsiUamutpDbRvNzKqE9dmF23la891oWrgMUNBg5Q/k7AEKz1zDJwE6FXGMdb+PA== X-Received: by 2002:a17:90b:180c:b0:29e:5ed:eada with SMTP id lw12-20020a17090b180c00b0029e05edeadamr1838341pjb.37.1710535531667; Fri, 15 Mar 2024 13:45:31 -0700 (PDT) Received: from chromium.org ([202.144.206.254]) by smtp.gmail.com with ESMTPSA id iq3-20020a17090afb4300b0029bb8ebdc23sm3400516pjb.37.2024.03.15.13.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 13:45:31 -0700 (PDT) From: Simon Glass To: devicetree@vger.kernel.org Cc: linux-mtd@lists.infradead.org, Michael Walle , Miquel Raynal , Rob Herring , Simon Glass , Conor Dooley , Krzysztof Kozlowski , =?utf-8?b?UmFmYcWC?= =?utf-8?b?IE1pxYJlY2tp?= , Richard Weinberger , Vignesh Raghavendra , linux-kernel@vger.kernel.org Subject: [PATCH v8 1/2] dt-bindings: mtd: fixed-partitions: Add alignment properties Date: Sat, 16 Mar 2024 09:45:20 +1300 Message-Id: <20240315204521.28613-1-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240315_134533_752003_232F5A4E X-CRM114-Status: GOOD ( 22.29 ) X-Spam-Score: -1.1 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 [...] Content analysis details: (-1.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1030 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 T_SCC_BODY_TEXT_LINE No description available. -0.9 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- (no changes since v7) 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>; + }; + };