public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Jordan Justen <jordan.l.justen@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>, Jiewen Yao <jiewen.yao@intel.com>,
	Michael Kinney <michael.d.kinney@intel.com>,
	edk2-devel-01 <edk2-devel@lists.01.org>
Subject: Re: [PATCH 1/5] OvmfPkg: introduce Q35TsegSizeLib (class header and sole lib instance)
Date: Mon, 26 Jun 2017 21:12:45 +0200	[thread overview]
Message-ID: <04147371-25a3-12d2-0cbd-6e07c816a880@redhat.com> (raw)
In-Reply-To: <149849999779.24605.15084992650352143991@jljusten-skl>

On 06/26/17 19:59, Jordan Justen wrote:
> On 2017-06-19 12:39:51, Laszlo Ersek wrote:
>>
>> Even if the PCDs were technically doable, I think I'd slightly prefer
>> the current approach. The PCI config space accesses at module startup
>> are minimal, and they affect only three modules. OTOH, introducing two
>> PCDs feels, in this particular case, a bit like "polluting" OvmfPkg.dec.
>> (Well, "PcdPreferredEsmramcTsegSzMask" would *replace*
>> "PcdQ35TsegMbytes", so it would mean the addition of one PCD.)
>>
>> Anyway, this is just a slight preference. What I feel much more strongly
>> about are the library APIs.
> 
> The library is the part that seems odd to me. A library just to deal
> with Q35 tseg seems a bit specific.

Maybe so, but that's only because edk2 requires all libraries (even
one-off utility ones) that are used by at least two modules to have
full-blown library classes. (NULL class library resolution is different,
but those in turn require constructors.) This makes the overhead for
small utility libraries worse.

Specifically, the first four patches in the series can be considered a
refactoring / improvement per se, because they centralize the
TSEG_SZ<->megabytes mapping to one module.

Extracting the mapping is also useful because the last patch can then
add the feature to all affected modules at once. If we proceed
piecemeal, then there's going to be a stage where the PEI phase modules
know how to handle extended TSEG, but the DXE phase doesn't. Not tragic,
but not optimal for bisection.

> I looked at this series a number of times. My thought is that:
> 
> * PcdQ35TsegMbytes should become dynamic
> 
> * No PCD for tseg mask
> 
> * PlatformPei adds knowledge of qemu ext tseg to set PcdQ35TsegMbytes
> 
> * SmmAccessPei adds dep on gEfiPeiMemoryDiscoveredPpiGuid to make sure
>   PcdQ35TsegMbytes is set.

Arbitrary and quite ugly, but I guess I can live with it.

> * SmmAccessPei adds some duplicated code to know about qemu ext tseg
>   for mask. (But, I think a reasonably small amount of dup code.)
> 
> * SmramInternal.c just reads the size from the PCD

This last bullet is a functional change for SmramAccessGetCapabilities()
that I wanted to avoid -- I sought to preserve the logic of working off
of the currently set (and possibly locked) contents of ESMRAMC.TSEG_SZ.

I guess the idea is still doable if SmramInternal.c introduces a global
variable for caching the PCD at module startup -- setting the variable
from the PCD would be the responsibility of each separate module, both
PEIM and DXE driver --, and then SmramAccessGetCapabilities() could use
the global variable if it read "11" binary from the TSEG_SZ bit-field
register.

This would be in effect the same as the current patch series, except the
bit-field<->MB mappings would remain scattered over the tree.

Please confirm if you are OK with the above and I'll spin a v2.

Thanks
Laszlo

> 
> Now, as usual, I expect you'll point out some trivially obvious issue
> that I missed. :)
> 
> -Jordan
> 



  reply	other threads:[~2017-06-26 19:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 17:13 [PATCH 0/5] OvmfPkg: recognize an extended TSEG when QEMU offers it Laszlo Ersek
2017-06-08 17:13 ` [PATCH 1/5] OvmfPkg: introduce Q35TsegSizeLib (class header and sole lib instance) Laszlo Ersek
2017-06-19 17:30   ` Jordan Justen
2017-06-19 19:39     ` Laszlo Ersek
2017-06-26 17:59       ` Jordan Justen
2017-06-26 19:12         ` Laszlo Ersek [this message]
2017-06-26 22:36           ` Jordan Justen
2017-06-26 23:04             ` Laszlo Ersek
2017-06-29 19:14               ` Jordan Justen
2017-07-01 20:42                 ` Laszlo Ersek
2017-07-02  5:50                   ` Jordan Justen
2017-06-21  0:52     ` Yao, Jiewen
2017-06-22 16:22       ` Laszlo Ersek
2017-06-08 17:13 ` [PATCH 2/5] OvmfPkg/PlatformPei: rebase to Q35TsegSizeLib Laszlo Ersek
2017-06-08 17:13 ` [PATCH 3/5] OvmfPkg/SmmAccess: rebase code unique to SmmAccessPei " Laszlo Ersek
2017-06-08 17:13 ` [PATCH 4/5] OvmfPkg/SmmAccess: rebase shared PEIM/DXE code " Laszlo Ersek
2017-06-08 17:13 ` [PATCH 5/5] OvmfPkg/Q35TsegSizeLib: recognize an extended TSEG when QEMU offers it Laszlo Ersek
2017-06-16  8:15 ` [PATCH 0/5] OvmfPkg: " Laszlo Ersek
2017-06-19 18:09 ` Jordan Justen
2017-06-19 22:39   ` Laszlo Ersek
2017-06-20 22:29     ` Laszlo Ersek

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=04147371-25a3-12d2-0cbd-6e07c816a880@redhat.com \
    --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