• Gaurav Batra's avatar
    powerpc/pseries/iommu: Split Dynamic DMA Window to be used in Hybrid mode · ff5163bb
    Gaurav Batra authored
    Dynamic DMA Window (DDW) supports TCEs that are backed by 2MB page
    size. In most configurations, DDW is big enough to pre-map all of LPAR
    memory for IO. Pre-mapping of memory for DMA results in improvements in
    IO performance.
    
    Persistent memory, vPMEM, can be assigned to an LPAR as well. vPMEM is
    not contiguous with LPAR memory and usually is assigned at high memory
    addresses.  This makes is not possible to pre-map both vPMEM and LPAR
    memory in the same DDW.
    
    For a dedicated adapter this limitation is not an issue. Dedicated
    adapters can have both Default DMA window, which is backed by 4K page
    size and a DDW backed by 2MB page size TCEs. In this scenario, LPAR
    memory is pre-mapped in the DDW.  Any DMA going to the vPMEM is routed
    via dynamically allocated TCEs in the default window.
    
    The issue arises with SR-IOV adapters. There is only one DMA window -
    either Default or DDW. If an LPAR has vPMEM assigned, memory is not
    pre-mapped in the DDW since TCEs needs to be allocated for vPMEM as well.
    In this case, DDW is created and TCEs are dynamically allocated for both
    vPMEM and LPAR memory.
    
    Today, DDW is only used in single mode - direct mapped TCEs or
    dynamically mapped TCEs. This enhancement breaks a single DDW in 2
    regions -
    
    	1. First region to pre-map LPAR memory
    	2. Second region to dynamically allocate TCEs for IO to vPMEM
    
    The DDW is split only if it is big enough to pre-map complete LPAR
    memory and still have some space left to dynamically map vPMEM. Maximum
    size possible DDW is created as permitted by the Hypervisor.
    Signed-off-by: default avatarGaurav Batra <gbatra@linux.ibm.com>
    Reviewed-by: default avatarBrian King <brking@linux.vnet.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/20240514014608.35537-1-gbatra@linux.ibm.com
    ff5163bb
iommu.c 48.7 KB