PCI/P2PDMA: Remove pci_p2pdma_[un]map_sg()
authorLogan Gunthorpe <logang@deltatee.com>
Fri, 8 Jul 2022 16:51:04 +0000 (10:51 -0600)
committerChristoph Hellwig <hch@lst.de>
Tue, 26 Jul 2022 11:28:08 +0000 (07:28 -0400)
This interface is superseded by support in dma_map_sg() which now supports
heterogeneous scatterlists. There are no longer any users, so remove it.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/pci/p2pdma.c
include/linux/pci-p2pdma.h

index 5d2538aa07781674b3ee44555611fb5319acb645..4496a7c5c4785377f9ce2487324d2a44091866f5 100644 (file)
@@ -872,72 +872,6 @@ static enum pci_p2pdma_map_type pci_p2pdma_map_type(struct dev_pagemap *pgmap,
        return type;
 }
 
-static int __pci_p2pdma_map_sg(struct pci_p2pdma_pagemap *p2p_pgmap,
-               struct device *dev, struct scatterlist *sg, int nents)
-{
-       struct scatterlist *s;
-       int i;
-
-       for_each_sg(sg, s, nents, i) {
-               s->dma_address = sg_phys(s) + p2p_pgmap->bus_offset;
-               sg_dma_len(s) = s->length;
-       }
-
-       return nents;
-}
-
-/**
- * pci_p2pdma_map_sg_attrs - map a PCI peer-to-peer scatterlist for DMA
- * @dev: device doing the DMA request
- * @sg: scatter list to map
- * @nents: elements in the scatterlist
- * @dir: DMA direction
- * @attrs: DMA attributes passed to dma_map_sg() (if called)
- *
- * Scatterlists mapped with this function should be unmapped using
- * pci_p2pdma_unmap_sg_attrs().
- *
- * Returns the number of SG entries mapped or 0 on error.
- */
-int pci_p2pdma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
-               int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-       struct pci_p2pdma_pagemap *p2p_pgmap =
-               to_p2p_pgmap(sg_page(sg)->pgmap);
-
-       switch (pci_p2pdma_map_type(sg_page(sg)->pgmap, dev)) {
-       case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE:
-               return dma_map_sg_attrs(dev, sg, nents, dir, attrs);
-       case PCI_P2PDMA_MAP_BUS_ADDR:
-               return __pci_p2pdma_map_sg(p2p_pgmap, dev, sg, nents);
-       default:
-               /* Mapping is not Supported */
-               return 0;
-       }
-}
-EXPORT_SYMBOL_GPL(pci_p2pdma_map_sg_attrs);
-
-/**
- * pci_p2pdma_unmap_sg_attrs - unmap a PCI peer-to-peer scatterlist that was
- *     mapped with pci_p2pdma_map_sg()
- * @dev: device doing the DMA request
- * @sg: scatter list to map
- * @nents: number of elements returned by pci_p2pdma_map_sg()
- * @dir: DMA direction
- * @attrs: DMA attributes passed to dma_unmap_sg() (if called)
- */
-void pci_p2pdma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
-               int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-       enum pci_p2pdma_map_type map_type;
-
-       map_type = pci_p2pdma_map_type(sg_page(sg)->pgmap, dev);
-
-       if (map_type == PCI_P2PDMA_MAP_THRU_HOST_BRIDGE)
-               dma_unmap_sg_attrs(dev, sg, nents, dir, attrs);
-}
-EXPORT_SYMBOL_GPL(pci_p2pdma_unmap_sg_attrs);
-
 /**
  * pci_p2pdma_map_segment - map an sg segment determining the mapping type
  * @state: State structure that should be declared outside of the for_each_sg()
index 8318a97c9c61e6b4caf922cce5c1da8e5a525937..2c07aa6b7665ca58752f96192a4e5551e8fd9949 100644 (file)
@@ -30,10 +30,6 @@ struct scatterlist *pci_p2pmem_alloc_sgl(struct pci_dev *pdev,
                                         unsigned int *nents, u32 length);
 void pci_p2pmem_free_sgl(struct pci_dev *pdev, struct scatterlist *sgl);
 void pci_p2pmem_publish(struct pci_dev *pdev, bool publish);
-int pci_p2pdma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
-               int nents, enum dma_data_direction dir, unsigned long attrs);
-void pci_p2pdma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
-               int nents, enum dma_data_direction dir, unsigned long attrs);
 int pci_p2pdma_enable_store(const char *page, struct pci_dev **p2p_dev,
                            bool *use_p2pdma);
 ssize_t pci_p2pdma_enable_show(char *page, struct pci_dev *p2p_dev,
@@ -83,17 +79,6 @@ static inline void pci_p2pmem_free_sgl(struct pci_dev *pdev,
 static inline void pci_p2pmem_publish(struct pci_dev *pdev, bool publish)
 {
 }
-static inline int pci_p2pdma_map_sg_attrs(struct device *dev,
-               struct scatterlist *sg, int nents, enum dma_data_direction dir,
-               unsigned long attrs)
-{
-       return 0;
-}
-static inline void pci_p2pdma_unmap_sg_attrs(struct device *dev,
-               struct scatterlist *sg, int nents, enum dma_data_direction dir,
-               unsigned long attrs)
-{
-}
 static inline int pci_p2pdma_enable_store(const char *page,
                struct pci_dev **p2p_dev, bool *use_p2pdma)
 {
@@ -119,16 +104,4 @@ static inline struct pci_dev *pci_p2pmem_find(struct device *client)
        return pci_p2pmem_find_many(&client, 1);
 }
 
-static inline int pci_p2pdma_map_sg(struct device *dev, struct scatterlist *sg,
-                                   int nents, enum dma_data_direction dir)
-{
-       return pci_p2pdma_map_sg_attrs(dev, sg, nents, dir, 0);
-}
-
-static inline void pci_p2pdma_unmap_sg(struct device *dev,
-               struct scatterlist *sg, int nents, enum dma_data_direction dir)
-{
-       pci_p2pdma_unmap_sg_attrs(dev, sg, nents, dir, 0);
-}
-
 #endif /* _LINUX_PCI_P2P_H */