From patchwork Tue Jun 7 10:21:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 579317 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp4917259max; Tue, 7 Jun 2022 03:22:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ4rTvP/zPS+YxWZKE/jXNnR61PjdrZN9ln0D0q0ElSNJQxdCzViUzMAtlF/TiCl+kmSFs X-Received: by 2002:a05:6638:3183:b0:330:ea5a:6217 with SMTP id z3-20020a056638318300b00330ea5a6217mr15808734jak.54.1654597372734; Tue, 07 Jun 2022 03:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654597372; cv=none; d=google.com; s=arc-20160816; b=WvbGaJGILlPDimqQJYFqTr1cUT/mZapqW6jbyA6buKGiK/ESgKtl1WuwIvsPWyMynk UwjAIYigWkz9CXT7DweaNrnBrXMa9qeXu3kAkhP1MQ4O1BUc9v6me1IxjGQVuZDmTZCJ yIYmsVWN+WiPUpVZ1fSG3CTTGcfCarbCjhwgb+z8lXGdE0XBiUcHf+h6sH9gJnvzr13v 0bph65LufTJGlNBimbma6MyBb+U5dfZxLI0znAgd+4ikqwStCDO9QmvSehYQ7EV7nZIZ qPrm3INgvc6qmehLbAx65tZJ7aikeELhOfd24PYqMsyt4SO37mIMrSTnCedzrrfVCWsx npog== 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=bvEgz1YuhJWcZRjLIkc4JPJiShuz7FUgGtVMvVS951A=; b=gl+eNqiNw0Z7dyH1HNyuQrstDaA6qj4l5B2GySKt73qqq9oBx4G4vr7FDbKhh+tV/f mL4gWBY/5+rdY28kWMaVQ8xmnyJt/mh7U1e9Ll4+qJwxHGK12E2bhjlm7/USV8goG7Ya 90YXDxfMJmK6t3do7qA+VVQXfOqWVu+K5/4sGG/czUTmZNMLpnvOZLY0lsSKKpF4SjX9 1K/RpmCjRUByhs/05x5jNyKAdXW4zDAJhBsQ6PHe5hn1JwF8G8ps8NsZCVTxSOqe4q5Y 7/TBVW+0tm6AMOwWEP8Gw8cEFwt7mdAGen4Z611NTIvg1Q5QB6L4HRuJXI/yIpDfd6Hx 05ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g14JjiBc; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id s193-20020a0251ca000000b00331bbce91f4si3605902jaa.149.2022.06.07.03.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 03:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g14JjiBc; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 845288437C; Tue, 7 Jun 2022 12:22:36 +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="g14JjiBc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CF36F84343; Tue, 7 Jun 2022 12:22: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-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 4F13B842F8 for ; Tue, 7 Jun 2022 12:22:28 +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-x430.google.com with SMTP id u3so23494363wrg.3 for ; Tue, 07 Jun 2022 03:22:28 -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=bvEgz1YuhJWcZRjLIkc4JPJiShuz7FUgGtVMvVS951A=; b=g14JjiBc1m9hzAXyqtRQCySusovfzWXZPY08gE4Hwz/gLeMOETZcU97cB8ygAY1hjg 1I/08kreY00OWxuFps3BcIr85Cc698lx83VY3XOa4nY4sqWW22EVEpyNnnNeb1UPSaJ9 OyhH3DaVll6TYVXHVmMwouoTBgMJVCexmGzHxJpSIiFBs1T1QGznuVkA3CdwENrOw+IJ C0w1D+X02nwdhTCJr7+vvJ1AHDwZSuN1pTICmqzHUHZ0JsiptOtc+VFS7BT7RQ9khfWQ UqbxmY2+60C2036Z7pURSaRCpYy3QJOJQTUBcUmP/xAAHldKpGOq7FNdO6laurX4qHfz hfgA== 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=bvEgz1YuhJWcZRjLIkc4JPJiShuz7FUgGtVMvVS951A=; b=CGQPx4iAMqHLPMa0N9RUDhDeE+MwbaVni7YJzUSFuKi6P2CAEx05KJg75aDSAExSY9 I1vzzcdDJGxxPQZ95b3zys5OlKlMoB1JPBDHEIV6lGi7bqnxJgBl2iUfBLFSbAryto0n ITPIZilFSEMHYHoPfy/tQ8gceeOMdAzjqsB4fapSVs3USi43bEHVhdEVxn5HpVafY39U Lch/MbDtj4HxM17uYChE0uoqsPi/VNmD2aLsvNr03F0jHu6U9iuBf7OPw3NeygOZPolu Nz7XjTD9NlgHXjS3KTs3fgrouipoY19aJ5eO8U1Su8+2HYjEuEAiQBNv2Sa7FbqpnIFA bfIA== X-Gm-Message-State: AOAM533AHUDPWkAu+eFsGqaLaOMwvOGfrz+94ohpQTodbB6ugXvMYXI7 VtwbSKAWtTzLz/eoZKRI85OR5rGcYU+8dg== X-Received: by 2002:adf:d1ed:0:b0:215:98d7:2a93 with SMTP id g13-20020adfd1ed000000b0021598d72a93mr19374722wrd.637.1654597347667; Tue, 07 Jun 2022 03:22:27 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:1181:a1da:3be2:1ef1:b537:8871]) by smtp.gmail.com with ESMTPSA id k7-20020a5d6d47000000b0020e5e906e47sm17373273wri.75.2022.06.07.03.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 03:22:27 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Etienne Carriere , Sughosh Ganu , Patrick Delaunay Subject: [PATCH v3 3/3] drivers: rng: optee_rng: register to CONFIG_OPTEE_SERVICE_DISCOVERY Date: Tue, 7 Jun 2022 12:21:26 +0200 Message-Id: <20220607102126.2605773-3-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220607102126.2605773-1-etienne.carriere@linaro.org> References: <20220607102126.2605773-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.5 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 v2. No change since v1. --- drivers/rng/Kconfig | 1 + drivers/rng/optee_rng.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/rng/Kconfig b/drivers/rng/Kconfig index c10f7d345b..14e95a6213 100644 --- a/drivers/rng/Kconfig +++ b/drivers/rng/Kconfig @@ -34,6 +34,7 @@ config RNG_MSM 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..90d9434395 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,13 @@ #define TA_HWRNG_UUID { 0xab7a617c, 0xb8e7, 0x4d8f, \ { 0x83, 0x01, 0xd0, 0x9b, 0x61, 0x03, 0x6b, 0x64 } } +#ifdef CONFIG_OPTEE_SERVICE_DISCOVERY +OPTEE_SERVICE_DRIVER(optee_rng) = { + .uuid = TA_HWRNG_UUID, + .driver_name = DRIVER_NAME, +}; +#endif + /** open_session_ta_hwrng() - Open session with hwrng Trusted App * * @dev: device @@ -177,7 +187,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,