From patchwork Wed Mar 24 07:09:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 12160353 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=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 8CCD2C433DB for ; Wed, 24 Mar 2021 07:14:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 03EEC619EC for ; Wed, 24 Mar 2021 07:14:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03EEC619EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOxjE-0003sB-QI for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 03:14:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOxei-0002Hr-NO; Wed, 24 Mar 2021 03:10:16 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:42598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOxeg-0008MG-M3; Wed, 24 Mar 2021 03:10:16 -0400 Received: by mail-pl1-x630.google.com with SMTP id v23so7425853ple.9; Wed, 24 Mar 2021 00:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3/o7dxIJvo+wY+R5e6q/EE3dKUI5sEW9NHgjAowAggU=; b=Sqzsam3iQNhxwjdlssfCWuNkuPf2hSnt1XEY4HslD7U0eTUvCjbVXueCN2DMAa//l/ XyZGxCMTyVoMWZaN0Y1zK5UonRpJkPQcnumMK6FW/tjoQA0gxVgnGTy9SrcqsBbF6dbd vhYTs6VW6Mfelm7xMB3+2CR8Zs+IXqUnERcxx/+6AIobl0cHGUI7qZIoYcAr2iDh27JZ NIQMS34CLc3Dkh2w0QfFsrshb+13RzlctZqoyQldkjQPmEVeaaJDM2GqbumQNGCOXOZK W2PSSV7aGKRoeedi3Cb1cYO1PMPT9RmwJCrb9Ah+dW1r+EIW/8yy/t8DtFF36lsj2+qB RCPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=3/o7dxIJvo+wY+R5e6q/EE3dKUI5sEW9NHgjAowAggU=; b=QSMS2APhMDab82Lnu7V7Fc5e+xFpgBtbrkA1jmEBOXBrmfwHCSg/aCXbofb/HDuL+Y LZPWxfSJIVZ09c66Fv1EPJfD3A107ZTOEnyra8y1ABKYC8wKfAnT/DacQy117OB30T/B 105aZ5vLVAnEgYDaABtrPm7/jR2azomNCcHfWvQKd3B/ZBRT2Xjt36Xf0yvBvgLfGGGP DUtvIDw8Cv5kzgBu2S7M6JojbIAO4gq4ln9qbuRHvvjuElJz3xU3183z/F4Ke19pHK7J G3PiqP3QWjbZ9ERHW3lGPd0ZrmHJFBa6BmA/6h+REPD8F+PAi6sORzAnKcSFylb3i/bi zEsA== X-Gm-Message-State: AOAM533E7mkOTuts+6zAgHEslSb9nwRxGT2+a1v6b1yXrfuee6pEG+uv zSYjTSMZmQIHx7ABp9yfuH0= X-Google-Smtp-Source: ABdhPJyS5VMB3V3xnh/SYfGgPUSqHcUNZYuC/39hD3sLCtsLggkoL4SA5w4DASaccaJ17MZX1L94Bw== X-Received: by 2002:a17:90a:f0d4:: with SMTP id fa20mr2011528pjb.220.1616569811746; Wed, 24 Mar 2021 00:10:11 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id y22sm1297116pfn.32.2021.03.24.00.10.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 00:10:10 -0700 (PDT) From: Joel Stanley To: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Subject: [PATCH v4 0/3] hw/misc: Model ASPEED hash and crypto engine Date: Wed, 24 Mar 2021 17:39:52 +1030 Message-Id: <20210324070955.125941-1-joel@jms.id.au> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=joel.stan@gmail.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , Peter Maydell , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" v4: Rebase on Philippe's memory region cleanup series [1] Address feedback from Cédric Rework qtest to run on ast2400, ast2500 and ast2600 v3: Rework qtest to not use libqtest-single.h, rebase to avoid LPC conflicts. v2: Address review from Andrew and Philippe. Adds a qtest. [1] https://lore.kernel.org/qemu-devel/20210312182851.1922972-1-f4bug@amsat.org/ This adds a model for the ASPEED hash and crypto engine (HACE) found on all supported ASPEED SoCs. The model uses Qemu's gcrypto API to perform the SHA and MD5 hashing directly in the machine's emulated memory space, which I found a neat use of Qemu's features. It has been tested using u-boot and from Linux userspace, and adds a qtest for the model running as part of the ast2600-evb, ast2500-evb and palmetto-bmc (to test ast2400) machines. Note that the tests will fail without Philippe's series. Joel Stanley (3): hw: Model ASPEED's Hash and Crypto Engine aspeed: Integrate HACE tests/qtest: Add test for Aspeed HACE docs/system/arm/aspeed.rst | 2 +- include/hw/arm/aspeed_soc.h | 3 + include/hw/misc/aspeed_hace.h | 43 ++++ hw/arm/aspeed_ast2600.c | 15 ++ hw/arm/aspeed_soc.c | 16 ++ hw/misc/aspeed_hace.c | 358 +++++++++++++++++++++++++++++++++ tests/qtest/aspeed_hace-test.c | 313 ++++++++++++++++++++++++++++ MAINTAINERS | 1 + hw/misc/meson.build | 1 + tests/qtest/meson.build | 3 + 10 files changed, 754 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/aspeed_hace.h create mode 100644 hw/misc/aspeed_hace.c create mode 100644 tests/qtest/aspeed_hace-test.c