From: Laszlo Ersek <lersek@redhat.com>
To: Nikita Leshenko <nikita.leshchenko@oracle.com>
Cc: Liran Alon <liran.alon@oracle.com>,
edk2-devel@lists.01.org, ard.biesheuvel@linaro.org
Subject: Re: PciBusDxe: PCI-Express bug with dynamic PcdPciExpressBaseAddress
Date: Thu, 13 Sep 2018 15:15:38 +0200 [thread overview]
Message-ID: <b44d624d-f966-0de8-6501-db20cdea75e1@redhat.com> (raw)
In-Reply-To: <AEE4DCD3-4F75-4375-B400-7BFBB1888053@oracle.com>
On 09/13/18 14:27, Nikita Leshenko wrote:
>
>
>> On 11 Sep 2018, at 15:34, Laszlo Ersek <lersek@redhat.com> wrote:
>>
>> "BasePciExpressLib" has the prefix "Base", meaning that it is supposed
>> to be usable in all types of firmware modules, even in SEC and PEIMs --
>> which may not have access to writeable memory except stack (i.e.
>> writeable global variables). Therefore modifying the original lib
>> instance so that it depend on writeable globals wouldn't have been right.
>>
>> We could have attempted to add the new library instance under MdePkg,
>> and not ArmVirtPkg, but that's just a (more difficult) special case of
>> point (1).
>>
>> (Obviously if you try to apply the nomenclature I describe above to
>> "BaseCachingPciExpressLib" as well, you'll see that it doesn't match.
>> And that's because, when I invented the name for that lib instance, in
>> 2015, I didn't know about the naming rules myself. :) In reality the lib
>> instance should be called "DxePciExpressLibCaching" -- with "Dxe" for
>> prefix, and "Caching" for suffix.)
>
> Thanks for the detailed explanation. I guess we have no choice
> but to copy BaseCachingPciExpressLib (renamed to
> DxePciExpressLibCaching) from ArmVirt to OVMF as well.
Uhh, hold on for a minute :) , "no choice but" is a bit of a stretch.
Where does OVMF enter the picture to begin with?
Between OvmfPkg and ArmVirtPkg, we have a sort-of rule that ArmVirtPkg
is allowed to consume OvmfPkg content, but not vice versa. So, we could
move (and rename) the lib instance from ArmVirtPkg to OvmfPkg, update
the reference(s) in ArmVirtPkg accordingly, and then consume the lib
instance in OvmfPkg as well... *if* there was any reason to consume the
lib instance in OvmfPkg in the first place.
(Of course if, by "we", you meant an internal Oracle use case, then I'm
not trying to pry. I took "we" as "upstream community". Emails are
ambiguous! :) )
> In order to prevent such bugs in the future, what do you think
> about changing the PCD reference in BasePciExpressLib.inf (in
> MdePkg) from [Pcd] to [FixedPcd]? This way a module that has a
> dynamic PcdPciExpressBaseAddress will fail to link with the
> default PCIE library. Is it practical to get such change into
> MdePkg despite their strict change policy?
I certainly think that's a valid approach if the PCD can only be Fixed
by design. However, judging by Ray's (as yet unanswered) followup
question in the thread:
http://mid.mail-archive.com/734D49CCEBEEF84792F5B80ED585239D5BDF99C7@SHSMSX104.ccr.corp.intel.com
I believe "by design" might not be a done deal just yet. Perhaps
BasePciExpressLib can be fixed to work with a dynamic PCD (and then we
should drop BaseCachingPciExpressLib in ArmVirtPkg too, and consume the
fixed BasePciExpressLib instance).
I suggest that you please file a bug for MdeModulePkg /
BasePciExpressLib in the TianoCore Bugzilla
<https://bugzilla.tianocore.org/>, referencing this discussion from the
mailing list archive
<https://lists.01.org/pipermail/edk2-devel/2018-September/029427.html>,
and request that (a) either the dynamic PCD use case be fixed, or (b)
the code own up to the restriction and be explicit about FixedPCD, both
in the INF file(s) and the C-language APIs.
Thanks!
Laszlo
next prev parent reply other threads:[~2018-09-13 13:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 19:08 PciBusDxe: PCI-Express bug with dynamic PcdPciExpressBaseAddress Nikita Leshenko
2018-09-07 0:25 ` Ni, Ruiyu
2018-09-07 8:44 ` Laszlo Ersek
2018-09-07 17:01 ` Liran Alon
2018-09-11 13:34 ` Laszlo Ersek
2018-09-13 12:27 ` Nikita Leshenko
2018-09-13 13:15 ` Laszlo Ersek [this message]
2018-09-16 12:28 ` Nikita Leshenko
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=b44d624d-f966-0de8-6501-db20cdea75e1@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