* [PATCH v1] tests/qtest/aspeed-acry: Allocate SRAM buffers on the heap
@ 2026-09-10 1:24 Jamin Lin
0 siblings, 0 replies; only message in thread
From: Jamin Lin @ 2026-09-10 1:24 UTC (permalink / raw)
To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
Kane Chen, Andrew Jeffery, Joel Stanley, Fabiano Rosas,
Laurent Vivier, Paolo Bonzini, open list:ASPEED BMCs,
open list:All patches CC here
Cc: Jamin Lin, Troy Lee
The ACRY RSA qtest allocates two ACRY_SRAM_SIZE buffers on the
stack. Since each buffer is nearly 9 KiB, this unnecessarily increases
the stack usage of test_modexp_rsa() and may cause unexpected failures
on environments with a limited stack size.
This reduces the stack usage while preserving the existing test
behavior.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
tests/qtest/aspeed-acry-test.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/qtest/aspeed-acry-test.c b/tests/qtest/aspeed-acry-test.c
index ec348c2206..51048d697c 100644
--- a/tests/qtest/aspeed-acry-test.c
+++ b/tests/qtest/aspeed-acry-test.c
@@ -327,8 +327,8 @@ static void test_modexp_rsa(const void *opaque)
.alg = QCRYPTO_AK_CIPHER_ALGO_RSA,
.u.rsa.padding_alg = QCRYPTO_RSA_PADDING_ALGO_RAW,
};
- uint8_t dram_buf[ACRY_SRAM_SIZE] = { 0 };
- uint8_t sram_buf[ACRY_SRAM_SIZE] = { 0 };
+ g_autofree uint8_t *dram_buf = g_malloc0(ACRY_SRAM_SIZE);
+ g_autofree uint8_t *sram_buf = g_malloc0(ACRY_SRAM_SIZE);
uint8_t result[ACRY_MAX_BYTES] = { 0 };
QTestState *qts;
@@ -345,7 +345,7 @@ static void test_modexp_rsa(const void *opaque)
put_bignum_be_bytes(dram_buf, ACRY_MOD_OFFSET, t->n, t->n_len);
put_bignum_be_bytes(dram_buf, ACRY_DATA_OFFSET, t->m, t->m_len);
- qtest_memwrite(qts, c->dram_addr, dram_buf, sizeof(dram_buf));
+ qtest_memwrite(qts, c->dram_addr, dram_buf, ACRY_SRAM_SIZE);
qtest_writel(qts, c->acry_addr + ACRY_DMA_CMD, ACRY_DMA_CMD_DMEM_AHB);
qtest_writel(qts, c->acry_addr + ACRY_DMA_SRC, c->dram_addr);
@@ -362,7 +362,7 @@ static void test_modexp_rsa(const void *opaque)
g_assert_cmphex(qtest_readl(qts, c->acry_addr + ACRY_STATUS), ==,
ACRY_STATUS_RSA_DONE);
- qtest_memread(qts, c->sram_addr, sram_buf, sizeof(sram_buf));
+ qtest_memread(qts, c->sram_addr, sram_buf, ACRY_SRAM_SIZE);
get_bignum_be_bytes(sram_buf, ACRY_DATA_OFFSET, result, t->c_len);
g_assert_cmpmem(result, t->c_len, t->c, t->c_len);
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-10 1:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10 1:24 [PATCH v1] tests/qtest/aspeed-acry: Allocate SRAM buffers on the heap Jamin Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox