From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by mx.groups.io with SMTP id smtpd.web08.34179.1612188078780023093 for ; Mon, 01 Feb 2021 06:01:19 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=vFKF0DNU; spf=pass (domain: linaro.org, ip: 209.85.219.178, mailfrom: ilias.apalodimas@linaro.org) Received: by mail-yb1-f178.google.com with SMTP id k4so16933657ybp.6 for ; Mon, 01 Feb 2021 06:01:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sq92vzJs1uTIJlfuEXcWFqlA56w8LP8xrNxJL+0kxb8=; b=vFKF0DNUpndH+ZnH2jldtC1zDgTKVP0K6QD0LNbRajg8L+vXd8oRktxzWgKEeWRE4D gHzfR1oiOXERMIW8EqPQrf890Tuopn6Yv2mvsUFwmHkrBI8IUYKn9fDnExIloRxEu9oc +3OW2wqlsZ00rjeqnhLc5F12nkt5MtWxyK3/vcMYD0tY1EidC9ew3ce86oNtBfV1y02Y ZIjJb2og9EYkrfkJ8zBKoT/qVy6sehyQuKXvSnJZzCSi/gECzuXdPWX++GPBJdF1Sj5w nCsILplMvxc4/3H0f/JpUpuOarN05EKg5TxOmsjornQdAIrR56hGZMCmjZMjBWpWEw3I ethw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sq92vzJs1uTIJlfuEXcWFqlA56w8LP8xrNxJL+0kxb8=; b=pkz9ZBWpFyDFxbUAl25VdXSXaKxqcinsPV3pPB1uYhz9lcqOdud3kCBqLIaeJqIZNH y0sWgDSdmG380Hb/xLcJzA6u3MT9BuI9O+J7iZVr7ns67JuWx1thmKtMHVB1Mo1dUsDu etR1pogRncgl8Bl+ErsE41oYwpKHCd0wk3fHVQFkLO7lpCbfuWIpAOv9TTj+cMO0z//m O8kS9WBADA+BrV13p9cAOBT4GELt2FTxcDWiVockXuOBXV6LrRW3PFEBTfuoMdgiJ9Ng ov0C0eeGi7wz+NXc54zROPDjlVcATV2ElvoKqrSPJCDFlwDL3GD+LydWipV6Nd/HR6Lq 1Jfg== X-Gm-Message-State: AOAM530U5tJOVMBPrCWI/8FiBsxHoj4EISxglYAH3yocgdtHS83/Bop/ WU8kNNpwE/PtvP/Mb4qVEKFbDooVQLyEmCg+m33+ng== X-Google-Smtp-Source: ABdhPJw8OxsTPGw5nNGJPv7lQVUq3yYTNimAIFkATfHa0fyTrET0r/ZPF9MUr5XgqnBJ4n9XUdETMrbt1W2IRmw6KMI= X-Received: by 2002:a25:5016:: with SMTP id e22mr13745221ybb.421.1612188077784; Mon, 01 Feb 2021 06:01:17 -0800 (PST) MIME-Version: 1.0 References: <20201216110903.17995-1-sughosh.ganu@linaro.org> <20201216110903.17995-2-sughosh.ganu@linaro.org> In-Reply-To: From: "Ilias Apalodimas" Date: Mon, 1 Feb 2021 16:00:39 +0200 Message-ID: Subject: Re: [PATCH edk2-platforms v3 1/2] Drivers/OpTeeRpmb: Add an OP-TEE backed RPMB driver To: Sami Mujawar Cc: Sughosh Ganu , "devel@edk2.groups.io" , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra Content-Type: text/plain; charset="UTF-8" Hi Sami, [...] > > +STATIC > > +EFI_STATUS > > +ReadWriteRpmb ( > > + UINTN SvcAct, > > + UINTN Addr, > > + UINTN NumBytes, > > + UINTN Offset > > + ) > > +{ > > + ARM_SVC_ARGS SvcArgs; > > + EFI_STATUS Status; > > + > > + ZeroMem (&SvcArgs, sizeof (SvcArgs)); > > + > > + SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64; > > + SvcArgs.Arg1 = storage_id; > > + SvcArgs.Arg2 = 0; > > + SvcArgs.Arg3 = SvcAct; > > + SvcArgs.Arg4 = Addr; > > + SvcArgs.Arg5 = NumBytes; > > + SvcArgs.Arg6 = Offset; > > + > > + ArmCallSvc (&SvcArgs); > > + if (SvcArgs.Arg3) { > > + DEBUG ((DEBUG_ERROR, "%a: Svc Call 0x%08x Addr: 0x%08x len: 0x%x Offset: 0x%x failed with 0x%x\n", > > + __func__, SvcAct, Addr, NumBytes, Offset, SvcArgs.Arg3)); > > + } > > + > > + switch (SvcArgs.Arg3) { > > + case ARM_SVC_SPM_RET_SUCCESS: > > + Status = EFI_SUCCESS; > > + break; > > + > > + case ARM_SVC_SPM_RET_NOT_SUPPORTED: > > + Status = EFI_UNSUPPORTED; > > + break; > > + > > + case ARM_SVC_SPM_RET_INVALID_PARAMS: > > + Status = EFI_INVALID_PARAMETER; > > + break; > > + > > + case ARM_SVC_SPM_RET_DENIED: > > + Status = EFI_ACCESS_DENIED; > > + break; > > + > > + case ARM_SVC_SPM_RET_NO_MEMORY: > > + Status = EFI_BAD_BUFFER_SIZE; > > + break; > > + > > + default: > > + Status = EFI_ACCESS_DENIED; > > + } > > [SAMI] Should the error handling here be updated similar to the FF-A StandaloneMmPkg patches? > > [/SAMI] > > I actually picked up the error handling from the previous non-FFA code. > I'll check what's on Sughosh latest patches and fix it if there are > any differences. > Looking at it again EFI_BAD_BUFFER_SIZE can change to indicate out of > memory properly anyway. > Had another look at this. This seems fine if I just change EFI_BAD_BUFFER_SIZE -> EFI OUT_OF_RESOURCES because OP-TEE is only using these errors from FFA. Eventually the OP-TEE code that launches StMM today, will move to FFA and become a separate SP, so that will naturally be handled once that's done. I don't see a point of adding unused error cases. Regards /Ilias