On Fri, 11 Oct 2013 14:35:50 +0200 Gerd Hoffmann kraxel@redhat.com wrote:
On Fr, 2013-10-11 at 12:19 +0200, Igor Mammedov wrote:
Currently 64-bit PCI BARs are unconditionally mapped by BIOS right over 4G + RamSizeOver4G location, which doesn't allow to reserve extra space before 64-bit PCI window. For memory hotplug an extra RAM space might be reserved after present 64-bit RAM end and BIOS should map 64-bit PCI BARs after it.
Introduce "etc/pcimem64-start" romfile to provide BIOS a hint where it should start mapping of 64-bit PCI BARs. If romfile is missing BIOS reverts to legacy behavior and starts mapping right after high memory.
Looks good overall.
struct pci_region r64_mem, r64_pref;
u64 base64 = le64_to_cpu(romfile_loadint("etc/pcimem64-start",
0x100000000ULL + RamSizeOver4G));
Should we sanity-check base64 maybe? Make sure it isn't smaller than 0x100000000ULL + RamSizeOver4G?
If it would be less than 0x100000000ULL + RamSizeOver4G then it would mean that QEMU for some reason decided to overshadow present RAM with PCI hole.
It would add a couple of extra bytes to BIOS and point where it should fail or at least print a warning that nobody will read at runtime. I think it's better to assert on QEMU side and abort even before guest started if it's considered as error.
cheers, Gerd