mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
Global: fix ArmFfaLibRun() caller couldn't get ret-args
When ArmFfaLibDirectMsgReq(2) is preempted, caller of these functions
should resume it works via ArmFfaLibRun() and the secure partition
will be return with FFA_DIRECT_MSG_RESP(2) with return arguments.
However, since ArmFfaLibRun() gets its return in its stack variable,
So caller of ArmFfaLibRun() doesn't get the return arguments from
secure partition.
To resolve this, add output parameter to ArmFfaLibRun() to
receive return arguments.
Continuous-integration-options: PatchCheck.ignore-multi-package
Fixes: 5d1b38dd07 ("ArmPkg: Add ArmFfaLib used in Dxe driver")
Reported-by: Mariam Elshakfy <Mariam.Elshakfy@arm.com>
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
This commit is contained in:
parent
57230fff6b
commit
d8e875e625
6 changed files with 51 additions and 14 deletions
|
|
@ -73,7 +73,7 @@ SendFfaMmCommunicate (
|
|||
|
||||
while (Status == EFI_INTERRUPT_PENDING) {
|
||||
// We are assuming vCPU0 of the StMM SP since it is UP.
|
||||
Status = ArmFfaLibRun (mStMmPartId, 0x00);
|
||||
Status = ArmFfaLibRun (mStMmPartId, 0x00, NULL);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ SendFfaMmCommunicate (
|
|||
|
||||
while (Status == EFI_INTERRUPT_PENDING) {
|
||||
// We are assuming vCPU0 of the StMM SP since it is UP.
|
||||
Status = ArmFfaLibRun (mStMmPartId, 0x00);
|
||||
Status = ArmFfaLibRun (mStMmPartId, 0x00, NULL);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
|
|
|||
|
|
@ -535,6 +535,7 @@ ErrorHandler:
|
|||
|
||||
@param [in] PartId Partition id
|
||||
@param [in] CpuNumber Cpu number in partition
|
||||
@param [out] DirectMsgArg return arguments for direct msg resp/resp2
|
||||
|
||||
@retval EFI_SUCCESS
|
||||
@retval Other Error
|
||||
|
|
@ -543,10 +544,12 @@ ErrorHandler:
|
|||
EFI_STATUS
|
||||
EFIAPI
|
||||
ArmFfaLibRun (
|
||||
IN UINT16 PartId,
|
||||
IN UINT16 CpuNumber
|
||||
IN UINT16 PartId,
|
||||
IN UINT16 CpuNumber,
|
||||
OUT DIRECT_MSG_ARGS *DirectMsgArg OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
ARM_FFA_ARGS FfaArgs;
|
||||
|
||||
ZeroMem (&FfaArgs, sizeof (ARM_FFA_ARGS));
|
||||
|
|
@ -556,7 +559,39 @@ ArmFfaLibRun (
|
|||
|
||||
ArmCallFfa (&FfaArgs);
|
||||
|
||||
return FfaArgsToEfiStatus (&FfaArgs);
|
||||
Status = FfaArgsToEfiStatus (&FfaArgs);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (DirectMsgArg != NULL) {
|
||||
ZeroMem (DirectMsgArg, sizeof (DIRECT_MSG_ARGS));
|
||||
|
||||
if (FfaArgs.Arg0 == ARM_FID_FFA_MSG_SEND_DIRECT_RESP) {
|
||||
DirectMsgArg->Arg0 = FfaArgs.Arg3;
|
||||
DirectMsgArg->Arg1 = FfaArgs.Arg4;
|
||||
DirectMsgArg->Arg2 = FfaArgs.Arg5;
|
||||
DirectMsgArg->Arg3 = FfaArgs.Arg6;
|
||||
DirectMsgArg->Arg4 = FfaArgs.Arg7;
|
||||
} else if (FfaArgs.Arg0 == ARM_FID_FFA_MSG_SEND_DIRECT_RESP2) {
|
||||
DirectMsgArg->Arg0 = FfaArgs.Arg4;
|
||||
DirectMsgArg->Arg1 = FfaArgs.Arg5;
|
||||
DirectMsgArg->Arg2 = FfaArgs.Arg6;
|
||||
DirectMsgArg->Arg3 = FfaArgs.Arg7;
|
||||
DirectMsgArg->Arg4 = FfaArgs.Arg8;
|
||||
DirectMsgArg->Arg5 = FfaArgs.Arg9;
|
||||
DirectMsgArg->Arg6 = FfaArgs.Arg10;
|
||||
DirectMsgArg->Arg7 = FfaArgs.Arg11;
|
||||
DirectMsgArg->Arg8 = FfaArgs.Arg12;
|
||||
DirectMsgArg->Arg9 = FfaArgs.Arg13;
|
||||
DirectMsgArg->Arg10 = FfaArgs.Arg14;
|
||||
DirectMsgArg->Arg11 = FfaArgs.Arg15;
|
||||
DirectMsgArg->Arg12 = FfaArgs.Arg16;
|
||||
DirectMsgArg->Arg13 = FfaArgs.Arg17;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ ArmFfaLibSpmIdGet (
|
|||
|
||||
@param [in] PartId Partition id
|
||||
@param [in] CpuNumber Cpu number in partition
|
||||
@param [out] DirectMsgArg return arguments for direct msg resp/resp2
|
||||
|
||||
@retval EFI_SUCCESS
|
||||
@retval Other Error
|
||||
|
|
@ -309,8 +310,9 @@ ArmFfaLibSpmIdGet (
|
|||
EFI_STATUS
|
||||
EFIAPI
|
||||
ArmFfaLibRun (
|
||||
IN UINT16 PartId,
|
||||
IN UINT16 CpuNumber
|
||||
IN UINT16 PartId,
|
||||
IN UINT16 CpuNumber,
|
||||
OUT DIRECT_MSG_ARGS *DirectMsgArg OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ Tpm2GetInterfaceVersion (
|
|||
Status = ArmFfaLibMsgSendDirectReq2 (mFfaTpm2PartitionId, &gTpm2ServiceFfaGuid, &FfaDirectReq2Args);
|
||||
while (Status == EFI_INTERRUPT_PENDING) {
|
||||
// We are assuming vCPU0 of the TPM SP since it is UP.
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00);
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00, &FfaDirectReq2Args);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
|
@ -254,7 +254,7 @@ Tpm2GetFeatureInfo (
|
|||
Status = ArmFfaLibMsgSendDirectReq2 (mFfaTpm2PartitionId, &gTpm2ServiceFfaGuid, &FfaDirectReq2Args);
|
||||
while (Status == EFI_INTERRUPT_PENDING) {
|
||||
// We are assuming vCPU0 of the TPM SP since it is UP.
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00);
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00, &FfaDirectReq2Args);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
|
@ -298,7 +298,7 @@ Tpm2ServiceStart (
|
|||
Status = ArmFfaLibMsgSendDirectReq2 (mFfaTpm2PartitionId, &gTpm2ServiceFfaGuid, &FfaDirectReq2Args);
|
||||
while (Status == EFI_INTERRUPT_PENDING) {
|
||||
// We are assuming vCPU0 of the TPM SP since it is UP.
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00);
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00, &FfaDirectReq2Args);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
|
@ -343,7 +343,7 @@ Tpm2RegisterNotification (
|
|||
Status = ArmFfaLibMsgSendDirectReq2 (mFfaTpm2PartitionId, &gTpm2ServiceFfaGuid, &FfaDirectReq2Args);
|
||||
while (Status == EFI_INTERRUPT_PENDING) {
|
||||
// We are assuming vCPU0 of the TPM SP since it is UP.
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00);
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00, &FfaDirectReq2Args);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
|
@ -380,7 +380,7 @@ Tpm2UnregisterNotification (
|
|||
Status = ArmFfaLibMsgSendDirectReq2 (mFfaTpm2PartitionId, &gTpm2ServiceFfaGuid, &FfaDirectReq2Args);
|
||||
while (Status == EFI_INTERRUPT_PENDING) {
|
||||
// We are assuming vCPU0 of the TPM SP since it is UP.
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00);
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00, &FfaDirectReq2Args);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
|
@ -417,7 +417,7 @@ Tpm2FinishNotified (
|
|||
Status = ArmFfaLibMsgSendDirectReq2 (mFfaTpm2PartitionId, &gTpm2ServiceFfaGuid, &FfaDirectReq2Args);
|
||||
while (Status == EFI_INTERRUPT_PENDING) {
|
||||
// We are assuming vCPU0 of the TPM SP since it is UP.
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00);
|
||||
Status = ArmFfaLibRun (mFfaTpm2PartitionId, 0x00, &FfaDirectReq2Args);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ Tpm2FfaCheckInterfaceVersion (
|
|||
Status = ArmFfaLibMsgSendDirectReq2 (TpmPartId, &gTpm2ServiceFfaGuid, &TpmArgs);
|
||||
while (Status == EFI_INTERRUPT_PENDING) {
|
||||
// We are assuming vCPU0 of the TPM SP since it is UP.
|
||||
Status = ArmFfaLibRun (TpmPartId, 0x00);
|
||||
Status = ArmFfaLibRun (TpmPartId, 0x00, &TpmArgs);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status) || (TpmArgs.Arg0 != TPM2_FFA_SUCCESS_OK_RESULTS_RETURNED)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue