[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [edk2] Passing Xen memory map and resource map to OVMF

On 11/14/13 08:58, Gerd Hoffmann wrote:
>   Hi,
>>>> OVMF
>>>> should just use whatever it gets.
>>> What would OVMF use them for?
>> To reserve range for MMIO holes, so that later PCI resource
>> allocation protocol can only use those ranges.
> I'm still not convinced you need that in the first place.
> When booting seabios @ xen it is not needed.  pci ressource allocation
> is handled by hvmloader.  apci tables (and the ressources declared
> therein) are handled by hvmloader.  seabios doesn't touch the pci bars
> and passes through the apci tables -> guest os is happy.
> So why ovmf should be different?   IMHO it should operate like seabios
> and NOT do pci ressource allocation when running on xen.  Ressources
> are already handled already by hvmloader.  Doing it again is (a)
> pointless and (b) creates problems like the one we are discussion
> right now.

The PEI (Pre-EFI Initialization) phase in UEFI has to produce a series
of hand-off blocks (HOBs) that describe a bunch of things for the later
phases of UEFI. One such set of information is the memory map used eg.
by the memory management functions called from drivers and applications.
ACPI tables are not enough.

So, these HOBs in PEI must come from somewhere. (Platform initialization
is officially platform-specific, so if on your platform ACPI tables come
to existence first, at some location in memory, you can key off those
when exporting the HOBs.)

The memmap-related HOBs we currently export in
"OvmfPkg/PlatformPei/Platform.c" are basically static, they only depend
on the memory size retrieved from the CMOS. I can imagine that more
flexibility is needed.

Also, PCI resource allocation (enumeration etc.) is just part of the PCI
bus driver in UEFI. Sometime earlier I wrote

> The MMIO range is allocated like this:
> PciEnumerator()                                                   
> [MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c]
>   PciHostBridgeResourceAllocator()                                
> [MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c]
>     NotifyPhase (PciResAlloc, EfiPciHostBridgeAllocateResources)  
> [MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c]
>       NotifyPhase()                                               
> [PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridge.c]
>         CoreAllocateMemorySpace()                                 
> [MdeModulePkg/Core/Dxe/Gcd/Gcd.c]
>           CoreAllocateSpace()
> The memory map base comes from CoreInitializeGcdServices() /
> MemMapInitialization().

The MemMapInitialization() function (in
"OvmfPkg/PlatformPei/Platform.c") mentioned in the quote is what we're
discussing now, that's what produces those early HOBs.

(Corrections welcome to whatever I said in this email.)


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.