Enable accumulative mode for direct access mode operations. In direct access mode, only a single source buffer is used, so the "iovec" count is set to 1. If "acc_mode" is enabled: 1. Accumulate "total_req_len" with the current request length ("plen"). 2. Check for padding and determine whether this is the final request.
Signed-off-by: Jamin Lin <jamin_...@aspeedtech.com> --- hw/misc/aspeed_hace.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c index 8cf3f194a5..d06158dffd 100644 --- a/hw/misc/aspeed_hace.c +++ b/hw/misc/aspeed_hace.c @@ -223,8 +223,21 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode, return; } iov[0].iov_base = haddr; - iov[0].iov_len = plen; i = 1; + if (acc_mode) { + s->total_req_len += plen; + + if (has_padding(s, &iov[0], plen, &total_msg_len, + &pad_offset)) { + /* Padding being present indicates the final request */ + sg_acc_mode_final_request = true; + iov[0].iov_len = pad_offset; + } else { + iov[0].iov_len = plen; + } + } else { + iov[0].iov_len = plen; + } } if (acc_mode) { -- 2.43.0