On 10/28/13 22:27, Jordan Justen wrote:
> Previously we would only search for MMIO regions that were also
> above every EfiGcdMemoryTypeReserved and EfiGcdMemoryTypeSystemMemory
> region.
> 
> Now we just search for the largest EfiGcdMemoryTypeMemoryMappedIo
> region.
> 
> This will allow us to mark the flash memory as a runtime memory
> region in order to allow runtime access of variables stored in
> flash.

What happens if this patch is not included?

According to my testing with a 5GB guest, the patch lowers the top of
the MMIO range
- from 0xFEEFFFFF
- to   0xFBFFFFFF

The FDF files set PcdOvmfFdBaseAddress to 0xFFF00000 (1MB build) or
0xFFE00000 (2MB build). Then patch #6 marks the memory from there
upwards as runtime memory.

  0xE0000000 == 3584 MB          MMIO start (both new & old)
  0xFBFFFFFF == 4032 MB - 1 B    MMIO end (new)
  0xFEEFFFFF == 4079 MB - 1 B    MMIO end (old)
  0xFFE00000 == 4094 MB          PcdOvmfFdBaseAddress (2MB build)
  0xFFF00000 == 4095 MB          PcdOvmfFdBaseAddress (1MB build)

So there doesn't seem to be an overlap with or without this patch.

But, even if there were an overlap that the patch eliminates (ie. if
PcdOvmfFdBaseAddress fell between the new and old MMIO ends), shouldn't
this patch rather find the bounding box (like before), and clamp it down
explicitly with PcdOvmfFdBaseAddress?

Because, the largest MMIO range that patch #4 currently finds is
arbitrary ("random") AFAICT. PcdOvmfFdBaseAddress is also (sort of)
arbitrary. I have no idea if anything guarantees that the largest single
MMIO range won't intersect with PcdOvmfFdBaseAddress.

But, again, what if there's an intersection? We're going to report an
MMIO range to the guest kernel (via _CRS) part of which is actually
memory. Probably worth avoiding indeed.

Thanks!
Laszlo

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to