• Alexey Kardashevskiy's avatar
    KVM: PPC: Book3S: Fix matching of hardware and emulated TCE tables · d5d7da80
    Alexey Kardashevskiy authored
    [ Upstream commit 76346cd9 ]
    
    When attaching a hardware table to LIOBN in KVM, we match table parameters
    such as page size, table offset and table size. However the tables are
    created via very different paths - VFIO and KVM - and the VFIO path goes
    through the platform code which has minimum TCE page size requirement
    (which is 4K but since we allocate memory by pages and cannot avoid
    alignment anyway, we align to 64k pages for powernv_defconfig).
    
    So when we match the tables, one might be bigger that the other which
    means the hardware table cannot get attached to LIOBN and DMA mapping
    fails.
    
    This removes the table size alignment from the guest visible table.
    This does not affect the memory allocation which is still aligned -
    kvmppc_tce_pages() takes care of this.
    
    This relaxes the check we do when attaching tables to allow the hardware
    table be bigger than the guest visible table.
    
    Ideally we want the KVM table to cover the same space as the hardware
    table does but since the hardware table may use multiple levels, and
    all levels must use the same table size (IODA2 design), the area it can
    actually cover might get very different from the window size which
    the guest requested, even though the guest won't map it all.
    
    Fixes: ca1fc489 "KVM: PPC: Book3S: Allow backing bigger guest IOMMU pages with smaller physical pages"
    Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    d5d7da80
Name
Last commit
Last update
..
boot Loading commit data...
configs Loading commit data...
crypto Loading commit data...
include Loading commit data...
kernel Loading commit data...
kvm Loading commit data...
lib Loading commit data...
math-emu Loading commit data...
mm Loading commit data...
net Loading commit data...
oprofile Loading commit data...
perf Loading commit data...
platforms Loading commit data...
purgatory Loading commit data...
sysdev Loading commit data...
tools Loading commit data...
xmon Loading commit data...
Kconfig Loading commit data...
Kconfig.debug Loading commit data...
Makefile Loading commit data...
Makefile.postlink Loading commit data...