QEMU-Arm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jamin Lin <jamin_lin@aspeedtech.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Steven Lee" <steven_lee@aspeedtech.com>,
	"Troy Lee" <leetroy@gmail.com>,
	"Kane Chen" <kane_chen@aspeedtech.com>,
	"Andrew Jeffery" <andrew@codeconstruct.com.au>,
	"Joel Stanley" <joel@jms.id.au>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: Jamin Lin <jamin_lin@aspeedtech.com>, Troy Lee <troy_lee@aspeedtech.com>
Subject: [PATCH v3 0/4] Add ASPEED ACRY RSA model for the AST2600
Date: Mon, 31 Aug 2026 02:44:51 +0000	[thread overview]
Message-ID: <20260831024450.27178-1-jamin_lin@aspeedtech.com> (raw)

This series adds a model of the ASPEED ACRY engine found on the AST2600
SoC, wires it into the SoC, and adds a qtest.

The ACRY engine performs RSA modular exponentiation (c = m^e mod n). It
DMAs the operands (data, exponent, and modulus) from guest DRAM and writes
the result to a dedicated 64 KiB SRAM region.

Guest firmware uses the engine for RSA signature verification during boot.
Without a model, the guest starts the engine and waits indefinitely for a
completion interrupt, causing the boot to hang.

The model uses QEMU's generic akcipher API to perform raw (unpadded) RSA.
Raw RSA is currently supported only by the libgcrypt backend, which can be
enabled alongside gnutls with -Dgcrypt=enabled, so a build does not have to
choose between the two. When raw RSA is unavailable, the engine still
completes and raises its interrupt, but returns an all-zero result. This
allows the guest's signature verification to fail cleanly instead of
hanging. The qtest is skipped when the selected crypto backend does not
support raw RSA.

Although the hardware documentation describes both RSA and ECDSA support,
ECDSA is known to be broken on this hardware and is therefore not modeled.

v1:
 1. Add ASPEED ACRY RSA model for the AST2600
 2. Add qtest for AST2600 ASPEED ACRY RSA model
 
v2:
 1. squash "Add the ACRY model to AspeedSoCState" into "Wire up the ACRY
    model"
 2. wrap the ACRY SRAM in a container mapped at offset 0 so the device
    addresses it by relative offset (drop the "sram-base" property)
 3. build the scattered SRAM byte offsets on the fly instead of caching
    them in per-instance lookup tables
 4. write the result with address_space_stl_le() and check the MemTxResult

v3:
  1. Return early when the DMA read of the operand buffer fails 
  2. Replace g_printerr with g_test_skip

Jamin Lin (4):
  hw/misc/aspeed_acry: Add ASPEED ACRY model
  hw/arm/aspeed_ast2600: Introduce the ACRY SRAM
  hw/arm/aspeed_ast2600: Wire up the ACRY model
  tests/qtest/aspeed-acry-test: Add RSA ModExp tests

 include/hw/arm/aspeed_soc.h    |   4 +
 include/hw/misc/aspeed_acry.h  |  39 +++
 hw/arm/aspeed_ast2600.c        |  34 +++
 hw/misc/aspeed_acry.c          | 456 +++++++++++++++++++++++++++++++++
 tests/qtest/aspeed-acry-test.c | 396 ++++++++++++++++++++++++++++
 hw/misc/meson.build            |   1 +
 hw/misc/trace-events           |   6 +
 tests/qtest/meson.build        |   5 +-
 8 files changed, 940 insertions(+), 1 deletion(-)
 create mode 100644 include/hw/misc/aspeed_acry.h
 create mode 100644 hw/misc/aspeed_acry.c
 create mode 100644 tests/qtest/aspeed-acry-test.c

-- 
2.53.0


             reply	other threads:[~2026-08-31  2:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  2:44 Jamin Lin [this message]
2026-08-31  2:44 ` [PATCH v3 1/4] hw/misc/aspeed_acry: Add ASPEED ACRY model Jamin Lin
2026-08-31  6:51   ` Cédric Le Goater
2026-09-01  7:20     ` Jamin Lin
2026-08-31  2:44 ` [PATCH v3 2/4] hw/arm/aspeed_ast2600: Introduce the ACRY SRAM Jamin Lin
2026-08-31  2:44 ` [PATCH v3 3/4] hw/arm/aspeed_ast2600: Wire up the ACRY model Jamin Lin
2026-08-31  5:53   ` Philippe Mathieu-Daudé
2026-08-31  2:44 ` [PATCH v3 4/4] tests/qtest/aspeed-acry-test: Add RSA ModExp tests Jamin Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260831024450.27178-1-jamin_lin@aspeedtech.com \
    --to=jamin_lin@aspeedtech.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=clg@kaod.org \
    --cc=farosas@suse.de \
    --cc=joel@jms.id.au \
    --cc=kane_chen@aspeedtech.com \
    --cc=leetroy@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=steven_lee@aspeedtech.com \
    --cc=troy_lee@aspeedtech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox