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

Re: [Xen-devel] [v3][PATCH 07/16] hvmloader/pci: skip reserved ranges



>>> On 16.06.15 at 11:29, <tiejun.chen@xxxxxxxxx> wrote:
> I'm trying to walk into this direction:
> 
>      /*
>       * We'll skip all space overlapping with reserved memory later,
>       * so we need to increase mmio_total to compensate them.
>       */
>      for ( j = 0; j < memory_map.nr_map ; j++ )
>      {
>          uint64_t conflict_size = 0;
>          if ( memory_map.map[j].type != E820_RAM )
>          {
>              reserved_start = memory_map.map[j].addr;
>              reserved_size = memory_map.map[j].size;
>              reserved_end = reserved_start + reserved_size;
>              if ( check_overlap(pci_mem_start, pci_mem_end - pci_mem_start,
>                                 reserved_start, reserved_size) )
>              {
>                  /*
>                   * Calculate how much mmio range conflict with
>                   * reserved device memory.
>                   */
>                  conflict_size += reserved_size;
> 
>                  /*
>                   * But we may need to subtract those sizes beyond the
>                   * pci memory, [pci_mem_start, pci_mem_end].
>                   */
>                  if ( reserved_start < pci_mem_start )
>                      conflict_size -= (pci_mem_start - reserved_start);
>                  if ( reserved_end > pci_mem_end )
>                      conflict_size -= (reserved_end - pci_mem_end);
>              }
>          }
> 
>          if ( conflict_size )
>          {
>              uint64_t conflict_size = max_t(
>                      uint64_t, conflict_size, max_bar_sz);
>              conflict_size &= ~(conflict_size - 1);
>              mmio_total += conflict_size;
>          }
>      }

This last thing goes in the right direction, but is complete overkill
when you have a small reserved region and a huge BAR. You
ought to work out the smallest power-of-2 region enclosing the
reserved range (albeit there are tricky corner cases to consider).

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®.