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>,
	edk2-devel-01 <edk2-devel@lists.01.org>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH 1/1] OvmfPkg/PlatformPei: support >=1TB high RAM, and discontiguous high RAM
Date: Fri, 4 Aug 2017 22:04:34 +0200	[thread overview]
Message-ID: <45baebf6-51d4-e81f-f2b3-f9a080ced353@redhat.com> (raw)
In-Reply-To: <150183662138.26642.8135798941756670502@jljusten-skl>

On 08/04/17 10:50, Jordan Justen wrote:
> On 2017-07-26 09:23:26, Laszlo Ersek wrote:
>> On 07/26/17 02:13, Jordan Justen wrote:
>>> On 2017-07-10 20:22:31, Laszlo Ersek wrote:
>>>> +STATIC
>>>> +EFI_STATUS
>>>> +E820HighRamIterate (
>>>> +  IN     E820_HIGH_RAM_ENTRY_CALLBACK Callback,
>>>> +  IN OUT VOID                         *Context
>>>> +  )
>>>
>>> I think a simpler option would be:
>>>
>>> STATIC
>>> EFI_STATUS
>>> ScanOrAddE820HighRam (
>>>   IN     E820_HIGH_RAM_ENTRY_CALLBACK Callback,
>>>   OUT    UINT64                       *MaxAddress  OPTIONAL
>>>   )
>>>
>>> If MaxAddress != NULL, then scan for it, otherwise add HOBs.
>>>
>>> Do you anticipate future needs where the iterate callback could be
>>> helpful?
>>
>> Not at the moment.
>>
>> Originally I started with two open-coded loops, but the code duplication
>> in this case was really ugly. Using callbacks simplified the call sites
>> very nicely. And, I was a bit concerned that you wouldn't like a
>> solution that wasn't generic enough :)
>>
>> I can rework the function like suggested if you prefer that.
> 
> I moved the code of the 2 callbacks into the the function and dropped
> the callbacks to see how it looked. It seemed a bit clearer and was
> less code.

OK, I'll do that.

> 
> The callback almost seems like something to consider for fw-cfg lib,
> except I don't think we really have the need today.

I agree that we don't need it now.

> 
>>>
>>> You might also consider ScanOrAdd64BitE820Ram to somewhat clarify that
>>> the 'HighRam' is addresses that don't fit in 32 bits.
>>
>> OK.
>>
>>>
>>>> +  QemuFwCfgSelectItem (FwCfgItem);
>>>> +  for (Processed = 0; Processed < FwCfgSize; Processed += sizeof E820Entry) {
>>>> +    QemuFwCfgReadBytes (sizeof E820Entry, &E820Entry);
>>>> +    DEBUG ((
>>>> +      DEBUG_VERBOSE,
>>>> +      "%a: Base=0x%Lx Length=0x%Lx Type=%u\n",
>>>> +      __FUNCTION__,
>>>> +      E820Entry.BaseAddr,
>>>> +      E820Entry.Length,
>>>> +      E820Entry.Type
>>>> +      ));
>>>> +    if (E820Entry.Type == EfiAcpiAddressRangeMemory &&
>>>> +        E820Entry.BaseAddr >= BASE_4GB) {
>>>
>>> I guess at least for IA32/X64, today, and for the foreseeable future
>>> the firmware device will cause a break at 4GB.
>>
>> Sorry, I don't understand. What do you mean by "firmware device" and
>> "break at 4GB"?
>>
>>> It seems like we could just check for the end of the range to be above
>>> 4GB to easily remove this assumption, right?
>>
>> I wanted to ensure that no RAM range would be included that (for any
>> unexpected reason) straddled the 4GB mark.
>>
>> Do you mean that the pflash address range is guaranteed to end at 4GB
>> (exclusive), so no RAM range can straddle the mark?
>>
>> Even so, what expression do you have in mind exactly? As far as I can
>> imagine, checking the end vs. the base of the E820 entry would only
>> complicate the above expression, not simplify it.
>>
>> Please elaborate :)
> 
> Yeah, I meant is there any easy way to handle a situation (unlike qemu
> piix4/q35 systems) where a RAM region went from below 4GB to above
> 4GB. If you don't think there is a simple was to handle it, then don't
> worry about it.

OK, thanks. I think it's out of scope for now.

Thanks
Laszlo


  reply	other threads:[~2017-08-04 20:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11  3:22 [PATCH 0/1] OvmfPkg/PlatformPei: support >=1TB high RAM, and discontiguous high RAM Laszlo Ersek
2017-07-11  3:22 ` [PATCH 1/1] " Laszlo Ersek
2017-07-11  8:38   ` Igor Mammedov
2017-07-11 13:10     ` Laszlo Ersek
2017-07-26  0:13   ` Jordan Justen
2017-07-26 16:23     ` Laszlo Ersek
2017-08-04  8:50       ` Jordan Justen
2017-08-04 20:04         ` Laszlo Ersek [this message]
2017-07-25 21:39 ` [PATCH 0/1] " 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=45baebf6-51d4-e81f-f2b3-f9a080ced353@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