From patchwork Tue Mar 23 07:39:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 406832 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp4226549jai; Tue, 23 Mar 2021 00:40:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/sxN/QDkAF2pM8hg0W/1FPRDv0PZxx1Fp2ZWrPW7ykVywIzLQNhJCUE5Mj33B/9CZXXo9 X-Received: by 2002:adf:fd91:: with SMTP id d17mr2521761wrr.0.1616485204722; Tue, 23 Mar 2021 00:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616485204; cv=none; d=google.com; s=arc-20160816; b=kPwFBjWobP4XKtwev3xjrJTF5HSMiLTVwsw2wOk4GLMKwtRLxbT8EarTk1esrp3JZX N7w9CZg8F6GAk9Wt9W+CeP4X6pkvbZ8VjCAB61C8dm63ZeCRSUDPBBWoePOjG2A08lIu R/vZdI/1KVjRIZyyiau4L807luEC+lPNsqD+UZpzEmcm5ImW3TJ0uaEWcAONNPp1rMmN EnTMZ0ESKhaopF28Polp9LJ5xRiu626Li+3qBvRw2kfF0s+AZuTBzoSVmFMj+uGibrUw nauiJNKOHnM3KfmBYPd4Ax0bKIKrLzyXzSeYqQ7lMlL3Aug27fFlWPKhiZdD7f8rdOpE tybw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dkim-signature; bh=AeMz6+NmHg+KEPzgGQMfu5yK0vJwvn7KlTXMwluykOA=; b=RJ4r2qjUTwvEMs0zqTpFzlkI9CBM8V6y8ElU4mpf4bBzjLuUeS3xMZDZnImS3254KV TZjymuL6fCmODESMPni2C4E4IKCw8JRjgHfHkJKr+rySRiH9rihzgwRbjvBqb8fTe8Qo PTidvLBmfnsYxjJPFWpBT0tPU5HvgqImZjO3Lzl4SMiR4kA9ni1xhtC4y9ibc7m59JEz FlZI7+8Cl+qAl7iT7WMxv4osYcQP4OiNwzP5vjQbsdkxSL4+/NlDqRuOc+awz7XjsVvt e0v4X4pBH1ZTmUemjn5xd1JKx0WVR90jIHX1855HzlJmvtUybH3LsjC66srrQ/snZ9fb I9Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=desiato.20200630 header.b=eApJVRo7; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IOgARvtD; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1:d65d:64ff:fe57:4e05 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from desiato.infradead.org (desiato.infradead.org. [2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by mx.google.com with ESMTPS id r2si15701747wrl.442.2021.03.23.00.40.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 00:40:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1:d65d:64ff:fe57:4e05 as permitted sender) client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=desiato.20200630 header.b=eApJVRo7; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IOgARvtD; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1:d65d:64ff:fe57:4e05 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=AeMz6+NmHg+KEPzgGQMfu5yK0vJwvn7KlTXMwluykOA=; b=eApJVRo7umrwoQOloS8OXFLk6I CT446FlTT5kXmZr8TGvSz059z/weHuZtHCXPcu+9ZzkxPnf7Olytg0ktxQnDogcBd73vNg5TUkqHZ 1L1YosFogwr5Ointk8gkoHsJP2DM3clmMgKkHNKGEoIewbnRKb3eHaTwiNsOCFB1m+bNxyS53PuHb zy8HQ8xrZc/j/AYbgElsFb0+zQJEYrVnKPziqBeouykcnSWT3A8DPS95VFCIHyT0xCQ/K5xj7+qn6 rXkqQsKAuaxyVB6OhWgswOuWgf1pV4xmsnSybapArFFUQhaWF8Zb5ExR2KrQylQJPZL0k2kP3/NNX E+R8IeiQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lObdl-00EBCK-O0; Tue, 23 Mar 2021 07:39:49 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lObdd-00EBAU-Pi for linux-mtd@lists.infradead.org; Tue, 23 Mar 2021 07:39:46 +0000 Received: by mail-pf1-x42a.google.com with SMTP id x126so13414651pfc.13 for ; Tue, 23 Mar 2021 00:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PvF1HrRBEs+yUQZzjOuXkf0eJP1lcdc9T4URK25JLiE=; b=IOgARvtDCkd4788B8IVLLNeGvkRiH8zapo76SvNMeVay8WkXWauSzwj6e0dBENjmcK svY9lsPOKeQ+1xfPCB+k1EROasuAfuFETH6u+Uqg64de5xEBcmf1qyuIuiooVVgRvpjc HBza6moWYqIUGNg/6cb9RV9zBFZrn3IBY2e3ZlLFCmsggYn3EG6gyMrbS1GtS7F6v/4z PbU0PFYNWZh5FMfniriUqJrHOC4ZyiAk1HumjI0Z1Yxf0F2rrWWa9sG3O3JqWBwijEPr PMGYM1y8Zp/nONQwprb1zliScimQZ4gHxaqqkBc58xIQKVYkPPOh9kIl7L1aFa7+1kWt ynyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PvF1HrRBEs+yUQZzjOuXkf0eJP1lcdc9T4URK25JLiE=; b=X8DBM4MSiDPTbRUDaXYij+slIl+xggkLZOOcFLRTjwXy2bn9SssZUkN+O0WdnXmnU8 mR2fUeeEz047YQ87NDAh1x1obaTV9XYTAtY7nShmRWm4KWBS/bj5HP9Q9WmI+BGooikt 8Wm4VB015K7mVgANXzivkYJnv3C1hp8BUmUqPb2yUoPo0zVdBTRc1NRh8/uhI9m+YKB9 gOgpVNJQSk5iw+jxqDyicZzc7AQ4/jq4mIiZtxvqsMg/MeGiiMqwZ2+Tjefq77aWgc2c +wO8b0X/ksfN3Rrb5f8aDhy7+DUgo4+4Y4xve1xjGoIbdUOs3AylZ+AXSw4BsWkA825m hkyw== X-Gm-Message-State: AOAM533hgMUA/wCvf9bIGiuIUS2QXALdCM9YdL9KV4Zs1m2eQJ7rlT8I txAlyoyImnAn8hpihnPX/bpU X-Received: by 2002:a05:6a00:1ad4:b029:216:aa9d:dcea with SMTP id f20-20020a056a001ad4b0290216aa9ddceamr3596742pfv.47.1616485179957; Tue, 23 Mar 2021 00:39:39 -0700 (PDT) Received: from localhost.localdomain ([103.77.37.149]) by smtp.gmail.com with ESMTPSA id fs9sm1587465pjb.40.2021.03.23.00.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 00:39:39 -0700 (PDT) From: Manivannan Sadhasivam To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, boris.brezillon@collabora.com, Daniele.Palmas@telit.com, bjorn.andersson@linaro.org, Manivannan Sadhasivam Subject: [PATCH v8 0/3] Add support for secure regions in NAND Date: Tue, 23 Mar 2021 13:09:27 +0530 Message-Id: <20210323073930.89754-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210323_073944_460295_6D881B69 X-CRM114-Status: GOOD ( 12.80 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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: On a typical end product, a vendor may choose to secure some regions in the NAND memory which are supposed to stay intact between FW upgrades. The access to those regions will be blocked by a secure e [...] Content analysis details: (-0.2 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:42a 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_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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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+patch=linaro.org@lists.infradead.org On a typical end product, a vendor may choose to secure some regions in the NAND memory which are supposed to stay intact between FW upgrades. The access to those regions will be blocked by a secure element like Trustzone. So the normal world software like Linux kernel should not touch these regions (including reading). So this series adds a property for declaring such secure regions in DT so that the driver can skip touching them. While at it, the Qcom NANDc DT binding is also converted to YAML format. Thanks, Mani Changes in v8: * Reworked the secure region check logic based on input from Boris * Removed the check where unnecessary in rawnand core. Changes in v7: * Made "size" u64 and fixed a warning reported by Kernel test bot Changes in v6: * Made use of "size" of the regions for comparision * Used "secure" instead of "sec" * Fixed the sizeof parameter in of_get_nand_secure_regions() Changes in v5: * Switched to "uint64-matrix" as suggested by Rob * Moved the whole logic from qcom driver to nand core as suggested by Boris Changes in v4: * Used "uint32-matrix" instead of "uint32-array" as per Rob's review. * Collected Rob's review tag for binding conversion patch Changes in v3: * Removed the nand prefix from DT property and moved the property parsing logic before nand_scan() in driver. Changes in v2: * Moved the secure-regions property to generic NAND binding as a NAND chip property and renamed it as "nand-secure-regions". Manivannan Sadhasivam (3): dt-bindings: mtd: Convert Qcom NANDc binding to YAML dt-bindings: mtd: Add a property to declare secure regions in NAND chips mtd: rawnand: Add support for secure regions in NAND memory .../bindings/mtd/nand-controller.yaml | 7 + .../devicetree/bindings/mtd/qcom,nandc.yaml | 196 ++++++++++++++++++ .../devicetree/bindings/mtd/qcom_nandc.txt | 142 ------------- drivers/mtd/nand/raw/nand_base.c | 105 ++++++++++ include/linux/mtd/rawnand.h | 14 ++ 5 files changed, 322 insertions(+), 142 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/qcom,nandc.yaml delete mode 100644 Documentation/devicetree/bindings/mtd/qcom_nandc.txt -- 2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ Reviewed-by: Rob Herring