From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E74BC4338F for ; Sat, 24 Jul 2021 17:22:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8B264606A5 for ; Sat, 24 Jul 2021 17:22:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8B264606A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 922B082F3A; Sat, 24 Jul 2021 19:22:55 +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="Y6Yiewf0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5E76682F3F; Sat, 24 Jul 2021 19:22:46 +0200 (CEST) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (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 C3C8282F00 for ; Sat, 24 Jul 2021 19:22:34 +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@google.com Received: by mail-wr1-x42d.google.com with SMTP id o1so5792028wrp.5 for ; Sat, 24 Jul 2021 10:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hHWd1R4xDA4lyVowPL87M8QuFzGqcDBX8A0jdJUm2B4=; b=Y6Yiewf0BrU8zrDj4sW4FjQ5Z2+w3n+9+SeGbIgcVFafw25nB6uHbZ+BTLfLSzRVJE aILeePpZ8pbGHkrXiydFv3F0nSNIwN5zFMN9ESqrFJcZ+TrKeE/uyt0Kdk3tKx2NHrL/ AfugR0Ia418Er6HYOE+eKJspvrli/7sF56pJ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hHWd1R4xDA4lyVowPL87M8QuFzGqcDBX8A0jdJUm2B4=; b=DlIAyXmHWqXwA9HXBLTHpCFPtehiQGzKF1o8LJQcZR+MQCsMoDyLQlpYXBC+tiO6TI 4OGX5sjsEtFEt+jova5UFsRbbVW6e9iCZI6ugitdta4mpAPOhYsLgTXVsw69kWmWqk8N KAKgwosoqY/NRjIzZh7FyuJgDK6VBS4Ns63grCHZQIcBjf/GQi50VWmxCImIKxLJRPJG bjYmSMjK/I1iyl7AB34shzFOJ8qPtohNSPA8ZLT4PZYAYhqMLeaB1jnd5umwiFAl0rn7 fQCzWSxlKI9dKbXGGF5nLvIsYyup+6wtoUz+y5v1HOsimfR96BDImzwWosBT0TjQjHAg BJzQ== X-Gm-Message-State: AOAM533w9TX4zyryB89w2x4G0uo5zj3k9iSz/+mzDIA4s6+pCahivojS /wzps4IFldaU2ZxSrLnhFN2ilZxi3h/7Qpn94NlExHLpY2h3pw== X-Google-Smtp-Source: ABdhPJwbzBDji3IdsN4KR19en/xhq53fAQxuW0pOii4QJK4cTDT0bqTLwf0jAZSFXud0HDAS9uemeAWr1c0dO4kYR5E= X-Received: by 2002:adf:f404:: with SMTP id g4mr10911694wro.56.1627147353909; Sat, 24 Jul 2021 10:22:33 -0700 (PDT) MIME-Version: 1.0 References: <20210720063839.1518-1-chiawei_wang@aspeedtech.com> <20210720063839.1518-4-chiawei_wang@aspeedtech.com> In-Reply-To: From: Simon Glass Date: Sat, 24 Jul 2021 11:22:21 -0600 Message-ID: Subject: Re: [PATCH v3 03/14] crypto: aspeed: Add AST2600 HACE support To: ChiaWei Wang Cc: Lukasz Majewski , Maxim Sloyko , U-Boot Mailing List , Ryan Chen , Joel Stanley Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Hi ChiaWei, On Fri, 23 Jul 2021 at 00:30, ChiaWei Wang wrote: > > Hi Simon, > > > -----Original Message----- > > From: Simon Glass > > Sent: Wednesday, July 21, 2021 2:33 AM > > > > Hi Chia-Wei, > > > > On Tue, 20 Jul 2021 at 00:38, Chia-Wei Wang > > wrote: > > > > > > From: Joel Stanley > > > > > > Hash and Crypto Engine (HACE) is designed to accelerate the throughput > > > of hash data digest, and symmetric-key encryption. > > > > > > Signed-off-by: Joel Stanley > > > Signed-off-by: Chia-Wei Wang > > > --- > > > drivers/crypto/Kconfig | 2 + > > > drivers/crypto/Makefile | 1 + > > > drivers/crypto/aspeed/Kconfig | 12 ++ > > > drivers/crypto/aspeed/Makefile | 1 + > > > drivers/crypto/aspeed/aspeed_hace.c | 308 > > > ++++++++++++++++++++++++++++ > > > 5 files changed, 324 insertions(+) > > > create mode 100644 drivers/crypto/aspeed/Kconfig create mode 100644 > > > drivers/crypto/aspeed/Makefile create mode 100644 > > > drivers/crypto/aspeed/aspeed_hace.c > > > > This hash interface is wonky. > > > > There should be a hash uclass and this driver should be in that uclass. The > > existing hw_... functions should be dropped. > > > > Please let me know if you need further guidance, but basically, we need a > > proper uclass and driver. > > I am thinking to take the UCLASS_MOD_EXP as an example to create UCLASS_HASH. > This UCLASS_HASH should provide .ops callback like UCLASS_MOD_EXP do to support both SW and HW implemented HSAH. > Is this a right direction to start with? Yes I think so. You can have API like those in struct hash_algo and hopefully remove that struct. Then there is a software driver to write. Then people can add hardware drivers as needed. The hash uclass needs provide a way to call the first driver it finds. We can either make it add a software driver or have it call the software functions directly if there is no (hardware) driver. I'm not sure which is best... - having a s/w driver requires binding it at runtime - not having a s/w driver makes the uclass a bit odd > > In addition, adding UCLASS_HASH may involve lots of common code modification. > Should we make it part of the current patch series? Or a new patch series after this one? I would prefer a series before this one since it needs to be done before this. Or patches in the same series if you prefer. The problem has been created already, unfortunately, so this is a clean-up. Regards, Simon