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

Re: [Xen-devel] [v11][PATCH 06/16] hvmloader/pci: Try to avoid placing BARs in RMRRs



>>> On 22.07.15 at 03:29, <tiejun.chen@xxxxxxxxx> wrote:
> --- a/tools/firmware/hvmloader/pci.c
> +++ b/tools/firmware/hvmloader/pci.c
> @@ -38,6 +38,46 @@ uint64_t pci_hi_mem_start = 0, pci_hi_mem_end = 0;
>  enum virtual_vga virtual_vga = VGA_none;
>  unsigned long igd_opregion_pgbase = 0;
>  
> +/* Check if the specified range conflicts with any reserved device memory. */
> +static bool check_overlap_all(uint64_t start, uint64_t size)
> +{
> +    unsigned int i;
> +
> +    for ( i = 0; i < memory_map.nr_map; i++ )
> +    {
> +        if ( memory_map.map[i].type == E820_RESERVED &&
> +             check_overlap(start, size,
> +                           memory_map.map[i].addr,
> +                           memory_map.map[i].size) )
> +            return true;
> +    }
> +
> +    return false;
> +}
> +
> +/* Find the lowest RMRR higher than base. */

This comment should have been updated; I'm doing this for you in
anticipation of this going in later today.

> +static int find_next_rmrr(uint32_t base)
> +{
> +    unsigned int i;
> +    int next_rmrr = -1;
> +    uint64_t end, min_end = (1ull << 32);
> +
> +    for ( i = 0; i < memory_map.nr_map ; i++ )
> +    {
> +        end = memory_map.map[i].addr + memory_map.map[i].size;
> +
> +        if ( memory_map.map[i].type == E820_RESERVED &&
> +             end > base &&
> +             min_end < min_end )

Surely "end < min_end"?

Or really I think this part should be concerned about the start of
the region, albeit it probably doesn't matter much since right
below 4G there shouldn't be an RMRR anyway. Just to be on the
safe side I'll at least make it "end <= min_end".

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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