Committed in r13682.

On Wed, Aug 22, 2012 at 11:03 AM, Laszlo Ersek <ler...@redhat.com> wrote:
> Hello Bei,
>
> On 08/22/12 18:38, Bei Guan wrote:
>
>> I find the latest Ovmf doesn't work on Xen. The related change is:
>> http://sourceforge.net/mailarchive/message.php?msg_id=29615810
>
> (svn rev 13572)
>
>> The issue may be the following code in OvmfPkg/PlatformPei/Platform.c
>>
>> +  AddIoMemoryRangeHob (TopOfMemory < BASE_2GB ? BASE_2GB : TopOfMemory,
>> 0xFEC00000);
>> +  AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB);
>> +  AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB);
>> +  AddIoMemoryBaseSizeHob (PcdGet32(PcdCpuLocalApicBaseAddress), SIZE_1MB);
>>
>> If change the
>> AddIoMemoryRangeHob (TopOfMemory < BASE_2GB ? BASE_2GB : TopOfMemory,
>> 0xFEC00000);
>> to
>> AddIoMemoryRangeHob (TopOfMemory < BASE_2GB ? BASE_2GB : TopOfMemory,
>> 0xFEC00000 - TopOfMemory);
>> it works.
>
> AddIoMemoryRangeHob():    takes MemoryBase and (absolute) MemoryLimit
> AddIoMemoryBaseSizeHob(): takes MemoryBase and (relative) MemorySize
>
> The line
>
>     AddIoMemoryRangeHob (
>       TopOfMemory < BASE_2GB ? BASE_2GB : TopOfMemory, 0xFEC00000);
>
> added by the patch selects the greater of {TopOfMemory, BASE_2GB} as
> MemoryBase, and fixes MemoryLimit at 0xFEC00000, no matter what
> MemoryBase was selected from the possible two.
>
> This line added by the patch works equivalently (but in my opinion, more
> clearly) to this removed section:
>
>     if (TopOfMemory < BASE_2GB) {
>       AddIoMemoryBaseSizeHob (BASE_2GB, 0xFC000000 - BASE_2GB);
>     } else {
>       AddIoMemoryBaseSizeHob (TopOfMemory, 0xFC000000 - TopOfMemory);
>     }
>
> As MemoryBase, the same
>
>     max {TopOfMemory, BASE_2GB}
>
> is selected. MemorySize is always calculated so that the absolute end
> falls to 0xFC000000.
>
> ... And this is where I introduced an error :(
>
> The logic seems OK, but the constant is wrong. 0xFEC00000 != 0xFC000000;
> my patch reports [0xFC000000, 0xFEC00000), an extra 44 MB, as MMIO.
>
> ... Hmm yes, I can see the conflict in InitializeXen() in
> "OvmfPkg/PlatformPei/Xen.c":
>
>   //
>   // Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000).
>   // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE.
>   //
>   AddReservedMemoryBaseSizeHob (0xFC000000, 0x1000000);
>
> The HVM loader needs the first 16 MB of that 44 MB.
>
> Can you please try the attached patch? I went through the rest of svn
> rev 13572 again, and it seems fine. (Famous last words...)
>
> Laszlo

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to