Re: [PATCH v4 02/23] lib/scatterlist: add flag for indicating P2PDMA segments in an SGL

From: Chaitanya Kulkarni
Date: Mon Dec 13 2021 - 16:55:14 EST


On 11/17/21 1:53 PM, Logan Gunthorpe wrote:
> Make use of the third free LSB in scatterlist's page_link on 64bit systems.
>
> The extra bit will be used by dma_[un]map_sg_p2pdma() to determine when a
> given SGL segments dma_address points to a PCI bus address.
> dma_unmap_sg_p2pdma() will need to perform different cleanup when a
> segment is marked as a bus address.
>
> Create a CONFIG_NEED_SG_DMA_BUS_ADDR_FLAG bool which depends on
> CONFIG_64BIT (so there is space in the page link for the new flag).
> CONFIG_PCI_P2PDMA will then depend on this so this means PCI P2PDMA will
> require CONFIG_64BIT. This should be acceptable as the majority of P2PDMA
> use cases are restricted to newer root complexes and roughly require the
> extra address space for memory BARs used in the transactions.
>
> Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>