From patchwork Tue Jul 26 14:21:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 593447 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b811:0:0:0:0 with SMTP id fc17csp3594706mab; Tue, 26 Jul 2022 07:23:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vkwIIM5+yJ9H5FAsH4ZJD4pFZqeMT/BLEkiQHGhv6g3bo7K02R8k33rWUARqXsVaPQ9j7q X-Received: by 2002:a05:6638:14cd:b0:341:46ad:f3da with SMTP id l13-20020a05663814cd00b0034146adf3damr7372570jak.36.1658845397088; Tue, 26 Jul 2022 07:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658845397; cv=none; d=google.com; s=arc-20160816; b=S0Wwv8oIRKD7Ko12WeEzgy8tpMk5FkZxzu/LDL3WNmwNXx4IB4z3hOCt6Rxv2oJCOq zhlhPrZRR/oSEFvoGApHzpnfCXgM/gDyMEl7PP8MmrenZs10aNpbC9ZjelWHK+Qq9n/H Ju8+LnJ+ocyNlUUhEXbT3vTiVjiQgoy/6jqi4weVIn1SUoxOUv89NNC20iyP97ro7zRz Km2xaefhHMwCTj9t4feTWEdM22dVieQTypI9Rw410hfzXSGaBxOq3AJgHhoMEDkbszM5 zZCcqtwpZfuWGrKMjW5JVWu55pX4wcr1g1lGK8ICyYCZnYG2+XK01BJq96HIJv2melC7 PcCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tsvpMjxBGT1rUOOnYbawjw0PRatF/sKB7VjZ6cYY2WU=; b=gwr5POEMN/Bol9Ms0noyAM8Jp6jzq4A0E40xdFkI8UDsD2+zwIqhDKwt41OynkDmCs XM0a1PEyS2DXlxyFQ9TtJvv/01N5BhhApCbk+tneKY2M6Ct15bBVS6FCHLL1FjBecCkk mw2WElM1/UZxSS+9OC2/nDe3l5mzwHQoWkedNfNOG/QPWO2qYBBL3fkKoGcTcW77JxmK Ww5bDgyravO62OzIkQdctCL5F1EiMGRAOo0ytZN5N2upUb0pJDLOWNXDzEEFZ+ZaCENi +e1e5SUhuXclQrHgIsmU2E7yG6ETXFuCK3C3kc+3TQPCm+9Xfu8nzN745flmm1Am6f2R hwxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jiQ6N0bv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id t20-20020a026414000000b0033eba21756esi754443jac.74.2022.07.26.07.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 07:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jiQ6N0bv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A410584051; Tue, 26 Jul 2022 16:22:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="jiQ6N0bv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 748448418E; Tue, 26 Jul 2022 16:22:48 +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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 015768407F for ; Tue, 26 Jul 2022 16:22:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x42b.google.com with SMTP id h8so20369533wrw.1 for ; Tue, 26 Jul 2022 07:22:45 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=tsvpMjxBGT1rUOOnYbawjw0PRatF/sKB7VjZ6cYY2WU=; b=jiQ6N0bvBRV1BH27r0EA9zCaV1MCqCfjIjqxru2VYopTp1tbjkLYcQXtGxvZuV9FVn qyldix1wBLPUXWkHUlqZX2RkYeXFD2PFXHtB6np3Qq1Z3jksAeszFjgWtGK50pCpTMIs 7GNWAjgT9cp6oma1y7jZxfN239pBey5HodhzowG4rCn+pdQfRi5W2RZtTiGbtySt5xOZ msakP85wfckUp1FCCiNEMspeDcFcLdOtUUd1ydG/daQKFXjNDuvks0lJ8jfPXo+xo6iT M/l4I4DaE6Vzsw4aZb5MrmcvQ+6wStUgGcO+kK/SL6MyRfosaZ9vVDq/lsr0Jt2Far9h 7VLA== 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=tsvpMjxBGT1rUOOnYbawjw0PRatF/sKB7VjZ6cYY2WU=; b=abiqXruYC3ShE10yhjmCZ16Yss3Nw40I7WhGH2j0vjdy4IL6gOLMeJ+2d3Jcc1BseM F/m/LXb8X3jb2bpv8yYlD19gtxAjo0Ur/l+3aa7zxZSgiCCB+34oBA9KJgboLjk3UoOA XAEbf1g7R+zFcNP/MIJ2nQmj+iRQlXIEYh4dfRAhTwn9k12EymNHmRCXM3vwm7tJFerJ 17FlpZzKfTDJbVq6co4xE/087p3jskk6mCRVaooBbcwmfOCjy1+krf3iRA8f2JZjh5au L2iysVDoJb4SHVdvGOqenIAtZKDmXWleHN5J5e+Bl6xwks7A0fZXi+rEiiEO4KZHTjJK IMHw== X-Gm-Message-State: AJIora/sGuG/PySAPI4ex55L1E5HJfUCE7MbOvyY2BgWbzRw1hnvNtEZ u8eLNO1pi+2ZCJbYPGQqJJRzbIkdDneD2A== X-Received: by 2002:a5d:6d8a:0:b0:21d:a6f3:f458 with SMTP id l10-20020a5d6d8a000000b0021da6f3f458mr11378552wrs.574.1658845365230; Tue, 26 Jul 2022 07:22:45 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:119c:31fb:8cfb:f47b:e69f:3313]) by smtp.gmail.com with ESMTPSA id i5-20020a1c3b05000000b003a31d200a7dsm18902950wma.9.2022.07.26.07.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 07:22:44 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Etienne Carriere , Sughosh Ganu , Patrick Delaunay Subject: [PATCH v5 3/3] drivers: rng: optee_rng: register to CONFIG_OPTEE_SERVICE_DISCOVERY Date: Tue, 26 Jul 2022 16:21:43 +0200 Message-Id: <20220726142143.1739265-3-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220726142143.1739265-1-etienne.carriere@linaro.org> References: <20220726142143.1739265-1-etienne.carriere@linaro.org> 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 Changes optee_rng driver to register itself has a OP-TEE service so that a device is bound for the driver when OP-TEE enumerates the PTA RNG service. Cc: Sughosh Ganu Cc: Patrick Delaunay Signed-off-by: Etienne Carriere Reviewed-by: Patrick Delaunay --- No change since v4. Changes since v3: - Unconditionally register driver with OPTEE_SERVICE_DRIVER() since the macro is now stubbed when CONFIG_OPTEE_SERVICE_DISCOVERY is disable. No change since v2. No change since v1. --- drivers/rng/Kconfig | 1 + drivers/rng/optee_rng.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/rng/Kconfig b/drivers/rng/Kconfig index 21a9ff0195..0cbb40add6 100644 --- a/drivers/rng/Kconfig +++ b/drivers/rng/Kconfig @@ -41,6 +41,7 @@ config RNG_NPCM config RNG_OPTEE bool "OP-TEE based Random Number Generator support" depends on DM_RNG && OPTEE + default y if OPTEE_SERVICE_DISCOVERY help This driver provides support for the OP-TEE based Random Number Generator on ARM SoCs where hardware entropy sources are not diff --git a/drivers/rng/optee_rng.c b/drivers/rng/optee_rng.c index aa8ce864d3..410dfc053f 100644 --- a/drivers/rng/optee_rng.c +++ b/drivers/rng/optee_rng.c @@ -11,6 +11,9 @@ #include #include #include +#include + +#define DRIVER_NAME "optee-rng" #define TEE_ERROR_HEALTH_TEST_FAIL 0x00000001 @@ -35,6 +38,8 @@ #define TA_HWRNG_UUID { 0xab7a617c, 0xb8e7, 0x4d8f, \ { 0x83, 0x01, 0xd0, 0x9b, 0x61, 0x03, 0x6b, 0x64 } } +OPTEE_SERVICE_DRIVER(optee_rng, TA_HWRNG_UUID, DRIVER_NAME); + /** open_session_ta_hwrng() - Open session with hwrng Trusted App * * @dev: device @@ -177,7 +182,7 @@ static const struct dm_rng_ops optee_rng_ops = { }; U_BOOT_DRIVER(optee_rng) = { - .name = "optee-rng", + .name = DRIVER_NAME, .id = UCLASS_RNG, .ops = &optee_rng_ops, .probe = optee_rng_probe,