Skip to content
  • Alexey Kardashevskiy's avatar
    vfio/spapr: Allow backing bigger guest IOMMU pages with smaller physical pages · c26bc185
    Alexey Kardashevskiy authored
    
    
    At the moment the PPC64/pseries guest only supports 4K/64K/16M IOMMU
    pages and POWER8 CPU supports the exact same set of page size so
    so far things worked fine.
    
    However POWER9 supports different set of sizes - 4K/64K/2M/1G and
    the last two - 2M and 1G - are not even allowed in the paravirt interface
    (RTAS DDW) so we always end up using 64K IOMMU pages, although we could
    back guest's 16MB IOMMU pages with 2MB pages on the host.
    
    This stores the supported host IOMMU page sizes in VFIOContainer and uses
    this later when creating a new DMA window. This uses the system page size
    (64k normally, 2M/16M/1G if hugepages used) as the upper limit of
    the IOMMU pagesize.
    
    This changes the type of @pagesize to uint64_t as this is what
    memory_region_iommu_get_min_page_size() returns and clz64() takes.
    
    There should be no behavioral changes on platforms other than pseries.
    The guest will keep using the IOMMU page size selected by the PHB pagesize
    property as this only changes the underlying hardware TCE table
    granularity.
    
    Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    c26bc185