From patchwork Tue Jul 5 19:23:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 1652685 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=mhP9TXUV; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LcszP71Krz9s07 for ; Wed, 6 Jul 2022 05:23:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 82D3484517; Tue, 5 Jul 2022 21:23:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="mhP9TXUV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 39D8C843AF; Tue, 5 Jul 2022 21:23:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (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 CE05B843AF for ; Tue, 5 Jul 2022 21:23:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=oleksandr.suvorov@foundries.io Received: by mail-lf1-x12c.google.com with SMTP id z13so22160433lfj.13 for ; Tue, 05 Jul 2022 12:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=falRjuT2wGPtIFhrcbHD5bSTOuSAtaY58B7AmdO9VGk=; b=mhP9TXUVvfyhrannYQRtiGvSCVNu0u0SRRcND1tfrc2twB5PgQAf1cq8Kv0hMWQGlu xs4wXk+rltstFzWcCm/tIrHm0Z7DrU0tExYouCrYDt1CREJiTfemyxcih+qNlOQYAoKY gH5P+EuUlsZh7LlWUfv4I4xcaNXIMEzZSMTSEm6+3Ef4icdLWyiJX5Uwm+WX+nesNFUo lOtqZ88LkmoXEMqNvOutFZv8PFHpW4f9KRvTbjZIucWUMI5+kZiBeBrJ16XK8jwqFqeN F7ZAEaUgva90kf3D0T6ofDwBTY0MdjAEXcLji6eXzJjfxXnJSPIu5JGUBWL11/LPPzOG dSNA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=falRjuT2wGPtIFhrcbHD5bSTOuSAtaY58B7AmdO9VGk=; b=Mx7H1BYbSSXAT1U2G6wLvzwUpI4cbDgaqpFL3c3La5C2s5JjRThbSqbIlCFshvlh4v s3mCs6NsPLfePiFhlmV/umt6xThVWsAoLDtxgAw2VknNxp2pUdw2FLwEBl21ISTD1nBB wi3hsuZkb6u4VgTE0mNAci6j3m9A5dg0T57kvmF1/5PHBfPoSJBo4y3zInSycLaENzsu UBKDQEUWlhR6AH4GJrYQyMI/+AQKDZxmYK8Oz1CW5ijX5fRlaUodHp9wPyK3OFbHndFY bKFvaydPnAxU+hFIpqkVIJPB0x3CI8Ff7VmO98egATvZsvAJGUbcZQsHcgEpqylHHlN+ eF6w== X-Gm-Message-State: AJIora+xPtkyakJZoQ7hWZfh46YqHSrBKj5YcxMIcmqC+3n/cwK4RaUj pKYq5k+CFE9TKxdSViXxJFBmZAgtEq2hng== X-Google-Smtp-Source: AGRyM1vsPazuj92XeM3rrC0S7Ts1vfiEcXhweVG3cahk12cInp8SBxhqqJnVAX6nIOulZajPjqHR5A== X-Received: by 2002:ac2:4d23:0:b0:47f:9bf4:972c with SMTP id h3-20020ac24d23000000b0047f9bf4972cmr24004685lfk.535.1657049007038; Tue, 05 Jul 2022 12:23:27 -0700 (PDT) Received: from cryobook.. ([93.188.34.55]) by smtp.gmail.com with ESMTPSA id x9-20020a056512078900b0047f6c48a603sm5850157lfr.202.2022.07.05.12.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 12:23:26 -0700 (PDT) From: Oleksandr Suvorov To: u-boot@lists.denx.de Cc: Adrian Fiergolski , Michal Simek , Jorge Ramirez-Ortiz , Ricardo Salveti , Igor Opaniuk , Oleksandr Suvorov , Ashok Reddy Soma , Heinrich Schuchardt , Masahisa Kojima , Michal Simek , Ovidiu Panait , Simon Glass Subject: [PATCH v11 01/13] fpga: add option for loading FPGA secure bitstreams Date: Tue, 5 Jul 2022 22:23:08 +0300 Message-Id: <20220705192320.415861-2-oleksandr.suvorov@foundries.io> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220705192320.415861-1-oleksandr.suvorov@foundries.io> References: <20220705192320.415861-1-oleksandr.suvorov@foundries.io> MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean It allows using this feature without enabling the "fpga loads" command. Signed-off-by: Oleksandr Suvorov Co-developed-by: Adrian Fiergolski Signed-off-by: Adrian Fiergolski Tested-by: Ricardo Salveti Tested-by: Adrian Fiergolski --- (no changes since v1) cmd/Kconfig | 3 ++- drivers/fpga/Kconfig | 14 ++++++++++++++ drivers/fpga/fpga.c | 2 +- drivers/fpga/xilinx.c | 2 +- drivers/fpga/zynqmppl.c | 4 ++-- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 09193b61b95..4a295c7b526 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1009,8 +1009,9 @@ config CMD_FPGA_LOADP a partial bitstream. config CMD_FPGA_LOAD_SECURE - bool "fpga loads - loads secure bitstreams (Xilinx only)" + bool "fpga loads - loads secure bitstreams" depends on CMD_FPGA + select FPGA_LOAD_SECURE help Enables the fpga loads command which is used to load secure (authenticated or encrypted or both) bitstreams on to FPGA. diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig index dc0b3dd31b7..6f8ef7b8dba 100644 --- a/drivers/fpga/Kconfig +++ b/drivers/fpga/Kconfig @@ -85,4 +85,18 @@ config FPGA_ZYNQPL Enable FPGA driver for loading bitstream in BIT and BIN format on Xilinx Zynq devices. +config FPGA_LOAD_SECURE + bool "Enable loading secure bitstreams" + depends on FPGA + help + Enables the fpga loads() functions that are used to load secure + (authenticated or encrypted or both) bitstreams on to FPGA. + +config SPL_FPGA_LOAD_SECURE + bool "Enable loading secure bitstreams for SPL" + depends on SPL_FPGA + help + Enables the fpga loads() functions that are used to load secure + (authenticated or encrypted or both) bitstreams on to FPGA. + endmenu diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c index fe3dfa12335..3b0a44b2420 100644 --- a/drivers/fpga/fpga.c +++ b/drivers/fpga/fpga.c @@ -220,7 +220,7 @@ int fpga_fsload(int devnum, const void *buf, size_t size, } #endif -#if defined(CONFIG_CMD_FPGA_LOAD_SECURE) +#if CONFIG_IS_ENABLED(FPGA_LOAD_SECURE) int fpga_loads(int devnum, const void *buf, size_t size, struct fpga_secure_info *fpga_sec_info) { diff --git a/drivers/fpga/xilinx.c b/drivers/fpga/xilinx.c index cbebefb55fe..6bc1bc491fb 100644 --- a/drivers/fpga/xilinx.c +++ b/drivers/fpga/xilinx.c @@ -172,7 +172,7 @@ int xilinx_loadfs(xilinx_desc *desc, const void *buf, size_t bsize, } #endif -#if defined(CONFIG_CMD_FPGA_LOAD_SECURE) +#if CONFIG_IS_ENABLED(FPGA_LOAD_SECURE) int xilinx_loads(xilinx_desc *desc, const void *buf, size_t bsize, struct fpga_secure_info *fpga_sec_info) { diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c index 6b394869dbf..8ff12bf50a0 100644 --- a/drivers/fpga/zynqmppl.c +++ b/drivers/fpga/zynqmppl.c @@ -245,7 +245,7 @@ static int zynqmp_load(xilinx_desc *desc, const void *buf, size_t bsize, return ret; } -#if defined(CONFIG_CMD_FPGA_LOAD_SECURE) && !defined(CONFIG_SPL_BUILD) +#if CONFIG_IS_ENABLED(FPGA_LOAD_SECURE) static int zynqmp_loads(xilinx_desc *desc, const void *buf, size_t bsize, struct fpga_secure_info *fpga_sec_info) { @@ -306,7 +306,7 @@ static int zynqmp_pcap_info(xilinx_desc *desc) struct xilinx_fpga_op zynqmp_op = { .load = zynqmp_load, -#if defined(CONFIG_CMD_FPGA_LOAD_SECURE) && !defined(CONFIG_SPL_BUILD) +#if CONFIG_IS_ENABLED(FPGA_LOAD_SECURE) .loads = zynqmp_loads, #endif .info = zynqmp_pcap_info,