mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
hw/misc/aspeed_hace: Ensure HASH_IRQ is always set to prevent firmware hang
Currently, if the program encounters an unsupported algorithm, it does not set
the HASH_IRQ bit in the status register and send an interrupt to indicate
command completion. As a result, the FW gets stuck waiting for a completion
signal from the HACE module.
Additionally, in do_hash_operation, if an error occurs within the conditional
statement, the HASH_IRQ bit is not set in the status register. This causes the
firmware to continuously send HASH commands, as it is unaware that the HACE
model has completed processing the command.
To fix this, the HASH_IRQ bit in the status register must always be set to
ensure that the firmware receives an interrupt from the HACE module, preventing
it from getting stuck or repeatedly sending HASH commands.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Fixes: c5475b3
("hw: Model ASPEED's Hash and Crypto Engine")
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250515081008.583578-4-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
c869da4edd
commit
fb8e59abbe
1 changed files with 9 additions and 9 deletions
|
@ -267,12 +267,6 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,
|
|||
iov[iov_idx - 1].iov_len, false,
|
||||
iov[iov_idx - 1].iov_len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set status bits to indicate completion. Testing shows hardware sets
|
||||
* these irrespective of HASH_IRQ_EN.
|
||||
*/
|
||||
s->regs[R_STATUS] |= HASH_IRQ;
|
||||
}
|
||||
|
||||
static uint64_t aspeed_hace_read(void *opaque, hwaddr addr, unsigned int size)
|
||||
|
@ -356,10 +350,16 @@ static void aspeed_hace_write(void *opaque, hwaddr addr, uint64_t data,
|
|||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: Invalid hash algorithm selection 0x%"PRIx64"\n",
|
||||
__func__, data & ahc->hash_mask);
|
||||
break;
|
||||
} else {
|
||||
do_hash_operation(s, algo, data & HASH_SG_EN,
|
||||
((data & HASH_HMAC_MASK) == HASH_DIGEST_ACCUM));
|
||||
}
|
||||
do_hash_operation(s, algo, data & HASH_SG_EN,
|
||||
((data & HASH_HMAC_MASK) == HASH_DIGEST_ACCUM));
|
||||
|
||||
/*
|
||||
* Set status bits to indicate completion. Testing shows hardware sets
|
||||
* these irrespective of HASH_IRQ_EN.
|
||||
*/
|
||||
s->regs[R_STATUS] |= HASH_IRQ;
|
||||
|
||||
if (data & HASH_IRQ_EN) {
|
||||
qemu_irq_raise(s->irq);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue