public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm" <quic_llindhol@quicinc.com>
To: Pierre Gondois <pierre.gondois@arm.com>
Cc: <devel@edk2.groups.io>, <sami.mujawar@arm.com>,
	<ardb+tianocore@kernel.org>, <rebecca@bsdio.com>,
	<kraxel@redhat.com>, <michael.d.kinney@intel.com>,
	<gaoliming@byosoft.com.cn>, <zhiguang.liu@intel.com>,
	<jiewen.yao@intel.com>, <jian.j.wang@intel.com>,
	<Matteo.Carlini@arm.com>, <Akanksha.Jain2@arm.com>,
	<Ben.Adderson@arm.com>, <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH v2 3/8] ArmPkg: Add Arm Firmware TRNG library
Date: Thu, 24 Mar 2022 18:12:50 +0000	[thread overview]
Message-ID: <Yjy0orQZJelOSUxm@qc-i7.hemma.eciton.net> (raw)
In-Reply-To: <384ff0c1-374c-09c4-3bcb-8110dfda22e2@arm.com>

On Thu, Mar 24, 2022 at 15:56:32 +0100, Pierre Gondois wrote:
> > > > > +/** Invoke the monitor call using the appropriate conduit.
> > > > > +    If PcdMonitorConduitHvc is TRUE use the HVC conduit else use SMC conduit.
> > > > > +
> > > > > +  @param [in, out]  Args    Arguments passed to and returned from the monitor.
> > > > > +
> > > > > +  @return  VOID
> > > > > +**/
> > > > > +STATIC
> > > > > +VOID
> > > > > +ArmCallMonitor (
> > > > > +  IN OUT ARM_MONITOR_ARGS   *Args
> > > > > +  )
> > > > > +{
> > > > > +  if (FeaturePcdGet (PcdMonitorConduitHvc)) {
> > > > > +    ArmCallHvc ((ARM_HVC_ARGS*)Args);
> > > > > +  } else {
> > > > > +    ArmCallSmc ((ARM_SMC_ARGS*)Args);
> > > > > +  }
> > > > > +}
> > > > Should this be in (a potentially renamed) ArmSmcLib?
> > > [SAMI] Looking at ArmSmcLib and ArmHvcLib libraries there is not much
> > > difference in the code other than the SMC/HVC call. Please let me know
> > > if I should submit a patch to unify these in ArmMonitorLib?
> > > The ArmCall<Smc|Hvc> APIs would still remain the same but moved to
> > > ArmMonitorLib.
> > 
> > Hello Leif,
> > About your comment, I am not sure I understand it correctly. Assuming the
> > function allowing to choose the conduit looks like:
> > 
> > VOID
> > EFIAPI
> > ArmConduitCall (UINT8 Conduit) {
> >     if (Conduit == 0) {
> >       ArmCallHvc ((ARM_HVC_ARGS*)Args);
> >     } else if (Conduit == 1) {
> >       ArmCallSmc ((ARM_SMC_ARGS*)Args);
> >     } else {
> >      ASSERT (FALSE);
> >     }
> > }
> > 
> > Do you suggest to:
> > 1. Make ArmSmcLib dependent on ArmHvcLib and add ArmConduitCall()
> >      in ArmSmcLib (or do the opposite with the ArmHvcLib)
> > 2. Merge ArmSmcLib and ArmHvcLib in a new ArmConduitLibrary and add
> >      ArmConduitCall() in this new library.
> > 3. Add an ArmConduitLibrary, relying on ArmSmcLib and ArmHvcLib, and having
> >      only one function: ArmConduitCall()
> >
> > 
> > 2. would make the Hvc and Smc calls really tied together.
> > 3. would avoid creating new dependencies on existing libraries (i.e. a
> > platform only using the ArmSmcLib would not require to have a NULL instance of
> > ArmHvcLib). I assume you meant 3.

I think 2 and 3 both capture the spirit of my request.

2 could potentially be achieved with a FixedPcd and conditionals in
asm (less sure about the armasm/vs situation).

I guess the question is if we think it plausible that a platform might
both want to use this new ArmConduitCall *and* directly make use of
ArmHvcLib/ArmSmcLib.

Best Regards,

Leif

  reply	other threads:[~2022-03-24 18:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 11:32 [PATCH v2 0/8] Add Raw algorithm support using Arm FW-TRNG interface Sami Mujawar
2021-11-16 11:32 ` [PATCH v2 1/8] MdePkg: Definition for TRNG library class interface Sami Mujawar
2021-11-16 11:32 ` [PATCH v2 2/8] ArmPkg: PCD to select conduit for monitor calls Sami Mujawar
2021-11-24 12:07   ` Leif Lindholm
2021-11-24 13:03     ` Ard Biesheuvel
2021-11-24 13:05       ` Leif Lindholm
2021-11-24 13:07         ` Ard Biesheuvel
2021-11-24 13:25           ` Leif Lindholm
2021-11-16 11:32 ` [PATCH v2 3/8] ArmPkg: Add Arm Firmware TRNG library Sami Mujawar
2021-11-24 13:01   ` [edk2-devel] " Leif Lindholm
2021-11-25 15:23     ` Sami Mujawar
2022-03-24  9:46       ` PierreGondois
     [not found]       ` <80941d66-5d31-053f-388a-95efe5dbbfdf@arm.com>
2022-03-24 14:56         ` PierreGondois
2022-03-24 18:12           ` Leif Lindholm [this message]
2021-11-16 11:32 ` [PATCH v2 4/8] MdePkg: Add NULL instance of TRNG Library Sami Mujawar
2021-11-16 11:32 ` [PATCH v2 5/8] SecurityPkg: Rename RdRandGenerateEntropy to common name Sami Mujawar
2021-11-16 11:32 ` [PATCH v2 6/8] SecurityPkg: Restructure checks in RngGetInfo Sami Mujawar
2021-11-16 11:32 ` [PATCH v2 7/8] SecurityPkg: Add RawAlgorithm support using TRNG library Sami Mujawar
2021-11-16 11:33 ` [PATCH v2 8/8] ArmVirtPkg: Kvmtool: Add RNG support using FW-TRNG interface Sami Mujawar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yjy0orQZJelOSUxm@qc-i7.hemma.eciton.net \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox