mbox series

[v4,0/3] hw/misc: Model ASPEED hash and crypto engine

Message ID 20210324070955.125941-1-joel@jms.id.au (mailing list archive)
Headers show
Series hw/misc: Model ASPEED hash and crypto engine | expand

Message

Joel Stanley March 24, 2021, 7:09 a.m. UTC
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

Comments

no-reply@patchew.org March 24, 2021, 7:30 a.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20210324070955.125941-1-joel@jms.id.au/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210324070955.125941-1-joel@jms.id.au
Subject: [PATCH v4 0/3] hw/misc: Model ASPEED hash and crypto engine

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20210324070955.125941-1-joel@jms.id.au -> patchew/20210324070955.125941-1-joel@jms.id.au
Switched to a new branch 'test'
5ebc2c5 tests/qtest: Add test for Aspeed HACE
6fc1946 aspeed: Integrate HACE
fa3bbae hw: Model ASPEED's Hash and Crypto Engine

=== OUTPUT BEGIN ===
1/3 Checking commit fa3bbae71dd5 (hw: Model ASPEED's Hash and Crypto Engine)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#22: 
new file mode 100644

WARNING: line over 80 characters
#95: FILE: hw/misc/aspeed_hace.c:69:
+    { HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA512, QCRYPTO_HASH_ALG_SHA512 },

WARNING: line over 80 characters
#96: FILE: hw/misc/aspeed_hace.c:70:
+    { HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA384, QCRYPTO_HASH_ALG_SHA384 },

WARNING: line over 80 characters
#97: FILE: hw/misc/aspeed_hace.c:71:
+    { HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA256, QCRYPTO_HASH_ALG_SHA256 },

ERROR: braces {} are necessary for all arms of this statement
#105: FILE: hw/misc/aspeed_hace.c:79:
+        if (mask == hash_algo_map[i].mask)
[...]

WARNING: line over 80 characters
#212: FILE: hw/misc/aspeed_hace.c:186:
+                          "%s: HMAC engine command mode %"PRIx64" not implemented",

total: 1 errors, 5 warnings, 408 lines checked

Patch 1/3 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/3 Checking commit 6fc194601e1b (aspeed: Integrate HACE)
3/3 Checking commit 5ebc2c5642da (tests/qtest: Add test for Aspeed HACE)
WARNING: line over 80 characters
#130: FILE: tests/qtest/aspeed_hace-test.c:91:
+    write_regs(s, base, src_addr, sizeof(test_vector), digest_addr, HACE_ALGO_MD5);

WARNING: line over 80 characters
#161: FILE: tests/qtest/aspeed_hace-test.c:122:
+    write_regs(s, base, src_addr, sizeof(test_vector), digest_addr, HACE_ALGO_SHA256);

WARNING: line over 80 characters
#192: FILE: tests/qtest/aspeed_hace-test.c:153:
+    write_regs(s, base, src_addr, sizeof(test_vector), digest_addr, HACE_ALGO_SHA512);

WARNING: line over 80 characters
#253: FILE: tests/qtest/aspeed_hace-test.c:214:
+    g_assert_cmphex(qtest_readl(s, base + HACE_HASH_DIGEST), ==, expected->dest);

WARNING: line over 80 characters
#256: FILE: tests/qtest/aspeed_hace-test.c:217:
+    g_assert_cmphex(qtest_readl(s, base + HACE_HASH_DATA_LEN), ==, expected->len);

total: 0 errors, 5 warnings, 335 lines checked

Patch 3/3 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210324070955.125941-1-joel@jms.id.au/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com