Skip to content

Commit 3401f63

Browse files
amit3sherbertx
authored andcommitted
crypto: ccp - do not request interrupt on cmd completion when irqs disabled
While sending a command to the PSP, we always requested an interrupt from the PSP after command completion. This worked for most cases. For the special case of irqs being disabled -- e.g. when running within crashdump or kexec contexts, we should not set the SEV_CMDRESP_IOC flag, so the PSP knows to not attempt interrupt delivery. Fixes: 8ef9795 ("crypto: ccp: Add panic notifier for SEV/SNP firmware shutdown on kdump") Based-on-patch-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Amit Shah <amit.shah@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent c299d7a commit 3401f63

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

drivers/crypto/ccp/sev-dev.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,18 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret)
910910

911911
sev->int_rcvd = 0;
912912

913-
reg = FIELD_PREP(SEV_CMDRESP_CMD, cmd) | SEV_CMDRESP_IOC;
913+
reg = FIELD_PREP(SEV_CMDRESP_CMD, cmd);
914+
915+
/*
916+
* If invoked during panic handling, local interrupts are disabled so
917+
* the PSP command completion interrupt can't be used.
918+
* sev_wait_cmd_ioc() already checks for interrupts disabled and
919+
* polls for PSP command completion. Ensure we do not request an
920+
* interrupt from the PSP if irqs disabled.
921+
*/
922+
if (!irqs_disabled())
923+
reg |= SEV_CMDRESP_IOC;
924+
914925
iowrite32(reg, sev->io_regs + sev->vdata->cmdresp_reg);
915926

916927
/* wait for command completion */

0 commit comments

Comments
 (0)