]> xenbits.xensource.com Git - xen.git/commit
hvmloader: use base instead of pci_mem_start for find_next_rmrr()
authorXiong Zhang <xiong.y.zhang@intel.com>
Fri, 6 Oct 2017 12:54:24 +0000 (14:54 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 6 Oct 2017 12:54:24 +0000 (14:54 +0200)
commit22ea7316e5440b16965471b5c1026f178ee9683e
treee0f6386757176054d33babc359cabb9d320ff9d7
parente7703a2e86f9002b414b6b6138c2f649af3224bc
hvmloader: use base instead of pci_mem_start for find_next_rmrr()

find_next_rmrr(base) is used to find the lowest RMRR ending above base
but below 4G. Current method couldn't cover the following situation:
a. two rmrr exist, small gap between them
b. pci_mem_start and mem_resource.base is below the first rmrr.base
c. find_next_rmrr(pci_mem_start) will find the first rmrr
d. After aligning mem_resource.base to bar size,
   first_rmrr.end < new_base < second_rmrr.base and
   new_base + bar_sz > second_rmrr.base.
   So the new bar will overlap with the second rmrr and doesn't overlap
with the first rmrr.
But the next_rmrr point to the first rmrr, then check_overlap() couldn't
find the overlap. Finally assign a wrong address to bar.

This patch using aligned new base to find the next rmrr, could fix the
above case and find all the overlapped rmrr with new base.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: ecc607b1851bc27140090da4d6124fd00090ec2b
master date: 2017-08-28 10:51:24 +0200
tools/firmware/hvmloader/pci.c