[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 06/25] hw/misc/aspeed_hace: Introduce 64-bit hash source addre
From: |
Jamin Lin |
Subject: |
[PATCH v2 06/25] hw/misc/aspeed_hace: Introduce 64-bit hash source address helper function |
Date: |
Tue, 13 May 2025 14:28:36 +0800 |
The AST2700 CPU, based on the Cortex-A35, is a 64-bit processor, and its DRAM
address space is also 64-bit. To support future AST2700 updates, the source
hash buffer address data type is being updated to 64-bit.
Introduces the "hash_get_source_addr()" helper function to extract the source
hash
buffer address.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
hw/misc/aspeed_hace.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c
index eb513ba00f..5f3c8190ef 100644
--- a/hw/misc/aspeed_hace.c
+++ b/hw/misc/aspeed_hace.c
@@ -142,21 +142,30 @@ static bool has_padding(AspeedHACEState *s, struct iovec
*iov,
return false;
}
+static uint64_t hash_get_source_addr(AspeedHACEState *s)
+{
+ uint64_t src_addr = 0;
+
+ src_addr = deposit64(src_addr, 0, 32, s->regs[R_HASH_SRC]);
+
+ return src_addr;
+}
+
static int hash_prepare_direct_iov(AspeedHACEState *s, struct iovec *iov)
{
- uint32_t src;
+ uint64_t src;
void *haddr;
hwaddr plen;
int iov_idx;
plen = s->regs[R_HASH_SRC_LEN];
- src = s->regs[R_HASH_SRC];
+ src = hash_get_source_addr(s);
haddr = address_space_map(&s->dram_as, src, &plen, false,
MEMTXATTRS_UNSPECIFIED);
if (haddr == NULL) {
qemu_log_mask(LOG_GUEST_ERROR,
- "%s: Unable to map address, addr=0x%x, "
- "plen=0x%" HWADDR_PRIx "\n",
+ "%s: Unable to map address, addr=0x%" HWADDR_PRIx
+ " ,plen=0x%" HWADDR_PRIx "\n",
__func__, src, plen);
return -1;
}
@@ -175,11 +184,12 @@ static int hash_prepare_sg_iov(AspeedHACEState *s, struct
iovec *iov,
uint32_t pad_offset;
uint32_t len = 0;
uint32_t sg_addr;
- uint32_t src;
+ uint64_t src;
int iov_idx;
hwaddr plen;
void *haddr;
+ src = hash_get_source_addr(s);
for (iov_idx = 0; !(len & SG_LIST_LEN_LAST); iov_idx++) {
if (iov_idx == ASPEED_HACE_MAX_SG) {
qemu_log_mask(LOG_GUEST_ERROR,
@@ -188,8 +198,6 @@ static int hash_prepare_sg_iov(AspeedHACEState *s, struct
iovec *iov,
return -1;
}
- src = s->regs[R_HASH_SRC] + (iov_idx * SG_LIST_ENTRY_SIZE);
-
len = address_space_ldl_le(&s->dram_as, src,
MEMTXATTRS_UNSPECIFIED, NULL);
sg_addr = address_space_ldl_le(&s->dram_as, src + SG_LIST_LEN_SIZE,
@@ -208,6 +216,8 @@ static int hash_prepare_sg_iov(AspeedHACEState *s, struct
iovec *iov,
return -1;
}
+ src += SG_LIST_ENTRY_SIZE;
+
iov[iov_idx].iov_base = haddr;
if (acc_mode) {
s->total_req_len += plen;
--
2.43.0
- [PATCH v2 01/25] hw/misc/aspeed_hace: Remove unused code for better readability, (continued)
- [PATCH v2 01/25] hw/misc/aspeed_hace: Remove unused code for better readability, Jamin Lin, 2025/05/13
- [PATCH v2 02/25] hw/misc/aspeed_hace: Improve readability and consistency in variable naming, Jamin Lin, 2025/05/13
- [PATCH v2 03/25] hw/misc/aspeed_hace: Ensure HASH_IRQ is always set to prevent firmware hang, Jamin Lin, 2025/05/13
- [PATCH v2 04/25] hw/misc/aspeed_hace: Refactor hash buffer setup into helper functions for clarity, Jamin Lin, 2025/05/13
- [PATCH v2 05/25] hw/misc/aspeed_hace: Split hash execution into helper functions for clarity, Jamin Lin, 2025/05/13
[PATCH v2 06/25] hw/misc/aspeed_hace: Introduce 64-bit hash source address helper function,
Jamin Lin <=
[PATCH v2 07/25] hw/misc/aspeed_hace: Rename R_HASH_DEST to R_HASH_DIGEST and introduce 64-bit hash digest address helper, Jamin Lin, 2025/05/13
[PATCH v2 08/25] hw/misc/aspeed_hace: Support accumulative mode for direct access mode, Jamin Lin, 2025/05/13
[PATCH v2 09/25] hw/misc/aspeed_hace: Move register size to instance class and dynamically allocate regs, Jamin Lin, 2025/05/13
[PATCH v2 13/25] hw/misc/aspeed_hace: Support to dump plaintext and digest for better debugging, Jamin Lin, 2025/05/13
[PATCH v2 12/25] hw/misc/aspeed_hace: Add trace-events for better debugging, Jamin Lin, 2025/05/13
[PATCH v2 10/25] hw/misc/aspeed_hace: Add support for source, digest, key buffer 64 bit addresses, Jamin Lin, 2025/05/13
[PATCH v2 14/25] tests/qtest: Reorder aspeed test list, Jamin Lin, 2025/05/13
[PATCH v2 19/25] test/qtest/hace: Add SHA-384 tests for AST2600, Jamin Lin, 2025/05/13
[PATCH v2 21/25] test/qtest/hace: Update source data and digest data type to 64-bit, Jamin Lin, 2025/05/13
[PATCH v2 11/25] hw/misc/aspeed_hace: Support DMA 64 bits dram address, Jamin Lin, 2025/05/13