From patchwork Fri Jun 3 10:27:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 578489 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp1368943max; Fri, 3 Jun 2022 03:30:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypACcy4Yz7jD5kMrNflGST5AiK7DKediMV2wn+WHayJV9ipc9DWu2YtxaUX7RLzNdroZsl X-Received: by 2002:a6b:ea09:0:b0:668:c4ba:5beb with SMTP id m9-20020a6bea09000000b00668c4ba5bebmr4555147ioc.77.1654252243850; Fri, 03 Jun 2022 03:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654252243; cv=none; d=google.com; s=arc-20160816; b=r5X6I3UGsZXx8+aMy7EjIdCg4o5hSots6pMzqiNwhJ3YoYGVdo5qLm6EZCM0SrTQpo YEwzV+LS1xIJa9AzHwk5zWG5p+eJ4Ah6zI2Op1GcBqh1nbLig8zEI/jtMe8NeERxWjSk 83itqO3hNiq5RkFNjNpNb/HVflifrT/BBJPahZmI2qXjGdSkik6u9dQVCMcZGs45KUC4 vQQ6CsSx330esSXBdwuP2is2OugjXtz8A/DNivzil0//ehot6oJ+33V8RKj/Vg19OlIU yDN2fNP/u96T7TF92jJemsn3eqVjezi7uhoisOf8pv4KKibRF5/yahTXe8tZvriXKFvo eNlg== 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=Pf6ZXtJzmRJC3z6KfbpzwXxZ0Z+z8duSJR7CzXh7xg8=; b=dnjTKzTjbUOuwdnV+pl0wa3AVi2PaB9k9tw7d80dliEQ14Dvx7374q2p4q733wPd2X z/9/M1PijBHGkTuRYWuoRZQh2B4n+fbojXkce7KQ677shx8eA2P+pEGJOpdQc2tzM0SO FV2oo7j9WJFa9jcTUuy/pT9MDxGaH7sqR2fw2ycfpPKS7fXeMVmItXN2qphV5uAVBMAE Mga8nTPXRFBV+f3e4dSBMn2NKOSku+14CashznU0RwhPYRTG9Dxtap4XRNr2SqHFDkrV iiFUAa7LOelfc9XiH5oafTSpVwPwi9vKvkH8UZ0V/DYwbR2NN/MxA7+23GT8D2EroVGa 24Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H4xFJCxf; 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 l3-20020a056638144300b00331373d76d5si9936792jad.108.2022.06.03.03.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 03:30:43 -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=H4xFJCxf; 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 5D58884300; Fri, 3 Jun 2022 12:30:22 +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="H4xFJCxf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 652DB83E60; Fri, 3 Jun 2022 12:30:10 +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-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 6F2FE83EFE for ; Fri, 3 Jun 2022 12:30:05 +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-wm1-x32c.google.com with SMTP id a10so1341371wmj.5 for ; Fri, 03 Jun 2022 03:30:05 -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=Pf6ZXtJzmRJC3z6KfbpzwXxZ0Z+z8duSJR7CzXh7xg8=; b=H4xFJCxfsqniq8OHRVZQXWKbImIqnIiTo//87VluG/3yuYuTYKK5Mvop1qghMjqGKH 8aeKsNv0S3Q5y2sQ/Hqs1CkEsI3jVaaFo3ciCm/TM9zi6v7267z52GPwOjNk4k+t94D4 c20d3uc2GDkUW50QL897OvumSbO6I5CcQzXxUW5uwQoIk2UM+duREaK4e0YvtvVb7ARB oOlXUx2aHHeLfDCAb/knxnaUJ5alPxkersFolkzmTxmzq3buCuc6oEMg7W+ZHsqraE3j zEx/t4Qi099iOxsFudMcZoGXIPdxDQeX3AIjsey+3ADFXzbvDyWgBemQs51LeQNmOKQ5 V/bA== 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=Pf6ZXtJzmRJC3z6KfbpzwXxZ0Z+z8duSJR7CzXh7xg8=; b=TC7oatY7kMRTe4Yg9OfxZMIeA7IXEfk2S55crClZbNgvVCdDX3gGV+RzO7N2AHGxfD MyXQxydgrjrLPgKHkyFbOGB8BIqKwB7WQxEtGYSYLh0y4nLtOhl0EDtEVVU2tHWt+bai vA8HyqJh9FlNqjyLZPQ8qPRzjvGntFkGAGq9tpW+UtyLOhvW4IJ7UeQvoI+pnwurClLq IyVlI2JOLKIMr63gU+9BDZ/kZ2jjSKqN31HAUs6BsEZYR5uLOWyOEHYTHzMsh/IQ/wD+ k6iN93VH48F1JNHqgi6EtX8et1jvS+/Xzeuennt+e1lB6biCezJ2F4bnrf/23FKgcRHd A9tA== X-Gm-Message-State: AOAM533lqkKRLdDhOmndQTd89234rNPrfn6peXQr+qBdlYKkNz5V/0dr Q9xE18GwBGxxHx7t7to/mhjL03kzZ0FQlQ== X-Received: by 2002:a7b:c932:0:b0:399:c7a6:44c4 with SMTP id h18-20020a7bc932000000b00399c7a644c4mr28414891wml.5.1654252204313; Fri, 03 Jun 2022 03:30:04 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:10bb:3bc2:7476:fed6:d8ef:5c31]) by smtp.gmail.com with ESMTPSA id b8-20020a056000054800b002137b2a233fsm4685404wrf.36.2022.06.03.03.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 03:30:03 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Etienne Carriere , Sughosh Ganu , Patrick Delaunay Subject: [PATCH v2 3/3] drivers: rng: optee_rng: register to CONFIG_OPTEE_SERVICE_DISCOVERY Date: Fri, 3 Jun 2022 12:27:01 +0200 Message-Id: <20220603102701.2316720-3-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220603102701.2316720-1-etienne.carriere@linaro.org> References: <20220603102701.2316720-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 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,