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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 570CDC433F5 for ; Sat, 30 Apr 2022 06:56:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3F88F83F06; Sat, 30 Apr 2022 08:56:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bW8RDKfZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CDFB983EF5; Sat, 30 Apr 2022 08:56:35 +0200 (CEST) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CE19983F0E for ; Sat, 30 Apr 2022 08:56:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-wr1-x42c.google.com with SMTP id t6so13325983wra.4 for ; Fri, 29 Apr 2022 23:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=P5drD0tFGvnud7BfDypCRRUKgLj5ddq8vN1xAfSbSMs=; b=bW8RDKfZCztIGlHWR7q3OO1HEMyURFbIag0xFouS/4LQl9+aYk+xZzVi9ETkX0YE1m 7NXEM7oB6cxTWrmvAi7Yw2YfV1bk3WK+fm9jXaRniu3jdS2q+Fk80RPQQFXhVR9+vt2Q GhttVjq+CQXMnvSx5K8XPhVs4TKY1G1WiolDU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=P5drD0tFGvnud7BfDypCRRUKgLj5ddq8vN1xAfSbSMs=; b=8H4JgRPzwIlyg24FValYD1c55xMUn7hQo+ung5OM1WDkMW1ouVGd0kqFSde9v7MVm3 eIevtjwSJAX14+lNGEVhDKv4ODqa7HNDJ3lp9F1XkdNgzeQdMVcUyl5C911Dtly2UrIr TvGatZk0VHH/hodltucjFX4jF6+9HWqvrPKgrP1uz0SAkjY+HKfT3k0sWSiZHjdnJxaS Z49oTs161ea7Q/qYL1zpUhkPKn8v6QvMM7lDJ0zitN0NQymBRYYIYKyz7xkzG/MoJYIQ tIoi1cJyAtBti6TEMpbN58eJKSRGuLQ6pFYNC82AbuKTDUpGwO9c75uAUTdjMyik8tXc 1siw== X-Gm-Message-State: AOAM533KuxRNIHBfNb30A9ljF/me77tfrnMxyuB73ISqvxa/MiXLqTtq /17DoWZYgA9AFzbATxRc3c75U7u/maW6Gw== X-Google-Smtp-Source: ABdhPJwtZvFTeqBQ6+5Xk/IMnY+2pXRRoDFxatUOsmugXEW3ZoirtkGqYFLHzoKFYAp3rejEnCde1A== X-Received: by 2002:a5d:5484:0:b0:20a:7ec0:9832 with SMTP id h4-20020a5d5484000000b0020a7ec09832mr2038104wrv.329.1651301790949; Fri, 29 Apr 2022 23:56:30 -0700 (PDT) Received: from sjg1.roam.corp.google.com (246.45-246-81.adsl-static.isp.belgacom.be. [81.246.45.246]) by smtp.gmail.com with ESMTPSA id v4-20020adfa1c4000000b0020ad05214d5sm1159484wrv.2.2022.04.29.23.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 23:56:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Philippe Reynes , Tom Rini , Marek Vasut , Simon Glass , Masahiro Yamada , Stephen Warren , Stephen Warren Subject: [PATCH v8 00/15] vpl: Introduce a verifying program loader Date: Sat, 30 Apr 2022 00:56:01 -0600 Message-Id: <20220430065616.310148-1-sjg@chromium.org> X-Mailer: git-send-email 2.36.0.464.gb9c8b46e94-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean U-Boot provides a verified-boot feature based around FIT, but there is no standard way of implementing it for a board. At present the various required pieces must be built up separately, to produce a working implementation. In particular, there is no built-in support for selecting A/B boot or recovery mode. This series introduces VPL, a verified program loader phase for U-Boot. Its purpose is to run the verified-boot process and decide which SPL binary should be run. It is critical that this decision happens before SPL runs, since SPL sets up SDRAM and we need to be able to update the SDRAM-init code in the field. Adding VPL into the boot flow provides a standard place to implement verified boot. This series includes the phase itself, some useful Kconfig options and a sandbox_vpl build for sandbox. No verfied-boot support is provided in this series. Most of the patches in this series are fixes and improvements to docs and various Kconfig conditions for SPL. This series requires the earlier sandbox fix patches[1] to be applied first. A test is included to make sure that VPL runs correctly for sandbox, i.e. that the TPL -> VPL -> SPL -> U-Boot flow works. Future work will add an implementation of verified boot into VPL. [1] https://patchwork.ozlabs.org/project/uboot/list/?series=297248 Changes in v8: - Rename the VPL symbols in spl.c - Support SYSCON and REGMAP too - Update defconfig to account for option changes - Drop reference to old OF_HOSTFILE option - Add new patch to support running vpl tests Changes in v7: - Add a few more options - Rebase to master - Update some options based on settings in master Changes in v6: - Add docs for sandbox_vpl build - Drop TPL_HASH_SUPPORT patch since we only have SPL_HASH now Changes in v5: - Rebase this patch on mainline (for GPIO and MISC Kconfig renames) Changes in v4: - Add new patch to correct bloblist Kconfig dependencies - Add new patch to avoid building avb in SPL - Update spl_phase_prefix() for VPL - Tidy up some of the Makefile rules - Add options for blk, core, misc and tpl also - Add VPL_SIZE_LIMIT - Add a sandbox_vpl build - Update cover letter Changes in v3: - Move VPL Kconfig options to a separate patch - Add full build support for VPL - Add a VPL size check (Kconfig option in next patch) Changes in v2: - Add some more VPL Kconfig options Simon Glass (15): test/py: Add a way to start sandbox without a device tree sandbox: Avoid binman error when run without device tree doc: Convert SPL documentation to ReST doc: Expand SPL docs to explain the phase and config test: Tidy up test building with SPL bloblist: Correct Kconfig dependencies avb: Don't build in SPL Makefile: Simplify devicetree rules for SPL/TPL Makefile: Tidy up the TPL build rules Introduce Verifying Program Loader (VPL) vpl: Add Kconfig options for VPL sandbox: Add a build for VPL vpl: Support running vpl tests vpl: Test that VPL runs correctly through to U-Boot proper CI: Run VPL tests .azure-pipelines.yml | 3 + .gitlab-ci.yml | 6 + Kconfig | 10 ++ Makefile | 28 +++- arch/sandbox/Kconfig | 8 + arch/sandbox/cpu/cpu.c | 27 ++- arch/sandbox/cpu/spl.c | 12 +- arch/sandbox/dts/sandbox.dtsi | 10 +- board/sandbox/MAINTAINERS | 7 + common/Kconfig | 71 +++++++- common/Makefile | 2 +- common/spl/Kconfig | 234 +++++++++++++++++++++++++- common/spl/spl.c | 25 ++- configs/sandbox_vpl_defconfig | 251 ++++++++++++++++++++++++++++ doc/arch/sandbox.rst | 13 ++ doc/develop/index.rst | 1 + doc/{README.SPL => develop/spl.rst} | 75 +++++++-- drivers/Makefile | 2 + drivers/block/Kconfig | 12 ++ drivers/clk/Kconfig | 26 +++ drivers/core/Kconfig | 54 +++++- drivers/core/Makefile | 2 +- drivers/gpio/Kconfig | 11 ++ drivers/i2c/Kconfig | 11 ++ drivers/misc/Kconfig | 28 ++++ drivers/pinctrl/Kconfig | 18 +- drivers/rtc/Kconfig | 9 + drivers/serial/Kconfig | 20 +++ drivers/sysreset/Kconfig | 10 ++ drivers/timer/Kconfig | 10 ++ drivers/tpm/Kconfig | 30 ++++ dts/Kconfig | 17 ++ include/bootstage.h | 2 + include/linux/kconfig.h | 3 + include/spl.h | 22 ++- lib/Kconfig | 62 +++++++ scripts/Kbuild.include | 4 + scripts/Makefile.autoconf | 12 ++ scripts/Makefile.build | 4 + scripts/Makefile.lib | 5 + scripts/Makefile.spl | 37 ++-- test/py/conftest.py | 7 +- test/py/tests/test_help.py | 26 +++ test/py/tests/test_vpl.py | 34 ++++ test/py/u_boot_console_sandbox.py | 22 ++- 45 files changed, 1215 insertions(+), 68 deletions(-) create mode 100644 configs/sandbox_vpl_defconfig rename doc/{README.SPL => develop/spl.rst} (68%) create mode 100644 test/py/tests/test_vpl.py -- 2.36.0.464.gb9c8b46e94-goog