From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bounce+27952+110487+7686176+12367111@groups.io>
Received: from mail02.groups.io (mail02.groups.io [66.175.222.108])
	by spool.mail.gandi.net (Postfix) with ESMTPS id DCB86D8067E
	for <rebecca@openfw.io>; Wed,  1 Nov 2023 17:05:44 +0000 (UTC)
DKIM-Signature: a=rsa-sha256; bh=qDdAYB4diejXGMRB8nlLZa4hB0FhlI7m55DdIbgaVK0=;
 c=relaxed/simple; d=groups.io;
 h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type;
 s=20140610; t=1698858343; v=1;
 b=Y3HJiQ4kISuHSQYw9KNLvkIhRifBZTnVFIFXfsxImc7oVJ/hPFfFdnPf9g/eUsokOzjKLbIX
 7mP1Jzq/DkwJVslikdHMUA8fgwSD6zL8N8MBzYfhqsf9U706NXmYjGoOLTPFin3Lx5AskwjPYeW
 BdWkhks3H1Mn3yQVzHqhXTNw=
X-Received: by 127.0.0.2 with SMTP id oLyBYY7687511x4GaSmqGWKy; Wed, 01 Nov 2023 10:05:43 -0700
X-Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178])
 by mx.groups.io with SMTP id smtpd.web11.13151.1698858342139224816
 for <devel@edk2.groups.io>;
 Wed, 01 Nov 2023 10:05:42 -0700
X-Received: by mail-vk1-f178.google.com with SMTP id 71dfb90a1353d-49d0ae5eb7bso14901e0c.0
        for <devel@edk2.groups.io>; Wed, 01 Nov 2023 10:05:41 -0700 (PDT)
X-Gm-Message-State: uB0wkPym5La9uojQUccApsxCx7686176AA=
X-Google-Smtp-Source: AGHT+IHgyB/XrKany+IzlHc9KWbniW1L66QGEXrDKvVELpm96CyCNv/kIMEUZlGT2+Mwvt5KEseVeJ9OPB7z8HC1B0s=
X-Received: by 2002:a1f:ac8b:0:b0:4a1:a334:57f6 with SMTP id
 v133-20020a1fac8b000000b004a1a33457f6mr15173938vke.1.1698858340859; Wed, 01
 Nov 2023 10:05:40 -0700 (PDT)
MIME-Version: 1.0
References: <PH8PR11MB68560B946A9D294738EBA95583A0A@PH8PR11MB6856.namprd11.prod.outlook.com>
 <22939.1698732760971227726@groups.io> <PH8PR11MB685618B80ED798FE1FB19ED983A0A@PH8PR11MB6856.namprd11.prod.outlook.com>
In-Reply-To: <PH8PR11MB685618B80ED798FE1FB19ED983A0A@PH8PR11MB6856.namprd11.prod.outlook.com>
From: "Dhaval Sharma" <dhaval@rivosinc.com>
Date: Wed, 1 Nov 2023 22:35:29 +0530
Message-ID: <CAAxYnhRbFDD3QaMba7DgkhzmKaKwQ8A=pFe7MiKDx5TmytLbbg@mail.gmail.com>
Subject: Re: [edk2-devel] [PATCH v7 5/5] OvmfPkg/RiscVVirt: Override for RV CPU Features
To: "Warkentin, Andrei" <andrei.warkentin@intel.com>, devel@edk2.groups.io
Precedence: Bulk
List-Subscribe: <mailto:devel+subscribe@edk2.groups.io>
List-Help: <mailto:devel+help@edk2.groups.io>
Sender: devel@edk2.groups.io
List-Id: <devel.edk2.groups.io>
Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io
Reply-To: devel@edk2.groups.io,dhaval@rivosinc.com
List-Unsubscribe-Post: List-Unsubscribe=One-Click
List-Unsubscribe: <https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/plugh>
Content-Type: multipart/alternative; boundary="000000000000ee662006091a4795"
X-GND-Status: LEGIT
Authentication-Results: spool.mail.gandi.net;
	dkim=pass header.d=groups.io header.s=20140610 header.b=Y3HJiQ4k;
	spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io;
	dmarc=none

--000000000000ee662006091a4795
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Andrei,
Are you suggesting:

   1. We have a generic PCD to store the address of RVFeatures bitfield.
   2. It gets populated at some point during initialization with let's say
   some kind of global variable address which keeps this bitfield.
   3. SEC/DXE phases deref this address and use where needed?

Is there a reference I can take a look at?

Assuming my above understanding is correct, the whole idea was to keep
implementation based on simple PCD such that it can be used easily as an
override mechanism. The reason to keep it "enabled" by default in MDE is
that if m-mode decides to keep it disabled it is anyways going to remain
that way. So practically this PCD is going to be useful only in cases where
the user wants to "Override Disable". LMK if you still think we should
modify the implementation.

=3DD

On Tue, Oct 31, 2023 at 10:31=E2=80=AFPM Warkentin, Andrei <
andrei.warkentin@intel.com> wrote:

> I think I misunderstood the intent. Reviewing the full patchset, it seems
> this is necessary to avoid using the new CMO path in the Virt platform
> (since the default value is all FFs). Shouldn=E2=80=99t the default Pcd v=
alue here
> be all 0=E2=80=99s =E2=80=93 i.e. CMO or any other feature use becomes =
=E2=80=9Copt in=E2=80=9D instead of
> =E2=80=9Copt out=E2=80=9D?
>
>
>
> It also seems that encoding the meaning inside the bit positions is a bit=
=E2=80=A6
> obscure. Have you considered storing a pointer to a struct with bitfields
> instead? You could then change the logic to be something like =E2=80=9CIf
> PcdPtrValue !=3D NULL && ((struct cast *) PcdPtrValue)->LegibleFieldName=
=E2=80=9D. I
> think this would do wonders for code maintainability. The cost of course =
is
> in having to initialize the Pcd now at runtime, and the additional
> dereference, but that seems like a low cost all things considered.
>
>
>
> *From:* Dhaval Sharma <dhaval@rivosinc.com>
> *Sent:* Tuesday, October 31, 2023 1:13 AM
> *To:* Warkentin, Andrei <andrei.warkentin@intel.com>; devel@edk2.groups.i=
o
> *Subject:* Re: [edk2-devel] [PATCH v7 5/5] OvmfPkg/RiscVVirt: Override
> for RV CPU Features
>
>
>
> Thanks. This PCD is for Virt platform only. Or maybe I am missing the
> point.
>


--=20
Thanks!
=3DD


-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110487): https://edk2.groups.io/g/devel/message/110487
Mute This Topic: https://groups.io/mt/102256471/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-



--000000000000ee662006091a4795
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Andrei,<div>Are you suggesting:</div><div><ol><li>We ha=
ve a generic PCD to store the address of RVFeatures bitfield.</li><li>It ge=
ts populated at some point during initialization with let&#39;s say some ki=
nd of global variable address which keeps this bitfield.</li><li>SEC/DXE ph=
ases deref this address and use where needed?</li></ol><div>Is there a refe=
rence I can take a look at?</div></div><div><br></div><div>Assuming my abov=
e understanding is correct, the whole idea was to keep implementation based=
 on simple PCD such that it can be used easily as an override mechanism. Th=
e reason to keep it &quot;enabled&quot; by default in MDE is that if m-mode=
 decides to keep it disabled it is anyways going to remain that way. So pra=
ctically this PCD is going to be useful only in cases where the user wants =
to &quot;Override Disable&quot;. LMK if you still think we should modify th=
e implementation.</div><div><br></div><div>=3DD</div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Oct 31, 2023=
 at 10:31=E2=80=AFPM Warkentin, Andrei &lt;<a href=3D"mailto:andrei.warkent=
in@intel.com">andrei.warkentin@intel.com</a>&gt; wrote:<br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px s=
olid rgb(204,204,204);padding-left:1ex"><div class=3D"msg-38786047620848271=
67">





<div lang=3D"EN-US" style=3D"overflow-wrap: break-word;">
<div class=3D"m_-3878604762084827167WordSection1">
<p class=3D"MsoNormal">I think I misunderstood the intent. Reviewing the fu=
ll patchset, it seems this is necessary to avoid using the new CMO path in =
the Virt platform (since the default value is all FFs). Shouldn=E2=80=99t t=
he default Pcd value here be all 0=E2=80=99s =E2=80=93 i.e.
 CMO or any other feature use becomes =E2=80=9Copt in=E2=80=9D instead of =
=E2=80=9Copt out=E2=80=9D?<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">It also seems that encoding the meaning inside the b=
it positions is a bit=E2=80=A6 obscure. Have you considered storing a point=
er to a struct with bitfields instead? You could then change the logic to b=
e something like =E2=80=9CIf PcdPtrValue !=3D NULL &amp;&amp;
 ((struct cast *) PcdPtrValue)-&gt;LegibleFieldName=E2=80=9D. I think this =
would do wonders for code maintainability. The cost of course is in having =
to initialize the Pcd now at runtime, and the additional dereference, but t=
hat seems like a low cost all things considered.<u></u><u></u></p>
<p class=3D"MsoNormal"><b><span><u></u>=C2=A0<u></u></span></b></p>
<p class=3D"MsoNormal"><b><span>From:</span></b><span> Dhaval Sharma &lt;<a=
 href=3D"mailto:dhaval@rivosinc.com" target=3D"_blank">dhaval@rivosinc.com<=
/a>&gt;
<br>
<b>Sent:</b> Tuesday, October 31, 2023 1:13 AM<br>
<b>To:</b> Warkentin, Andrei &lt;<a href=3D"mailto:andrei.warkentin@intel.c=
om" target=3D"_blank">andrei.warkentin@intel.com</a>&gt;; <a href=3D"mailto=
:devel@edk2.groups.io" target=3D"_blank">devel@edk2.groups.io</a><br>
<b>Subject:</b> Re: [edk2-devel] [PATCH v7 5/5] OvmfPkg/RiscVVirt: Override=
 for RV CPU Features</span><u></u><u></u></p>
<div style=3D"border-top:none;border-right:none;border-bottom:none;border-l=
eft:1.5pt solid blue;padding:0in 0in 0in 4pt">
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal"><span>Thanks. This PCD is for Virt platform only. Or=
 maybe I am missing the point.
<u></u><u></u></span></p>
</div>
</div>
</div>

</div></blockquote></div><br clear=3D"all"><div><br></div><span class=3D"gm=
ail_signature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signatu=
re"><div dir=3D"ltr">Thanks!<div>=3DD</div></div></div>


<div width=3D"1" style=3D"color:white;clear:both">_._,_._,_</div>
<hr>


Groups.io Links:<p>


 =20
    You receive all messages sent to this group.
 =20
 =20


<p>
<a target=3D"_blank" href=3D"https://edk2.groups.io/g/devel/message/110487"=
>View/Reply Online (#110487)</a> |


 =20

|

  <a target=3D"_blank" href=3D"https://groups.io/mt/102256471/7686176">Mute=
 This Topic</a>


| <a href=3D"https://edk2.groups.io/g/devel/post">New Topic</a>

<br>




<a href=3D"https://edk2.groups.io/g/devel/editsub/7686176">Your Subscriptio=
n</a> |
<a href=3D"mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href=3D"https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [rebecca@openfw.io]<br>
<div width=3D"1" style=3D"color:white;clear:both">_._,_._,_</div>


--000000000000ee662006091a4795--