]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Revert "sparc64: bypass iommu to use 64bit address space"
authorAllen Pais <allen.pais@oracle.com>
Fri, 7 Jul 2017 07:35:34 +0000 (13:05 +0530)
committerAllen Pais <allen.pais@oracle.com>
Tue, 11 Jul 2017 07:36:49 +0000 (13:06 +0530)
This reverts commit 34edb40e5e13cba76ad13646d3a1823d877851c6.

Conflicts:
arch/sparc/kernel/pci_sun4v.c

Orabug: 21149316

Reviewed-by: chris hyser <chris.hyser@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/Kconfig
arch/sparc/kernel/iommu.c
arch/sparc/kernel/pci_sun4v.c
arch/sparc/kernel/pci_sun4v.h
arch/sparc/kernel/pci_sun4v_asm.S

index d7066e6141c0e46bd3c8ef56daae2e26fdb78706..0075cb6bb231c9a4431234358c98313769400fff 100644 (file)
@@ -86,10 +86,6 @@ config SPARC64
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_USE_QUEUED_SPINLOCKS
 
-config ARCH_DMA_ADDR_T_64BIT
-       bool
-       default y if SPARC64
-
 config ARCH_DEFCONFIG
        string
        default "arch/sparc/configs/sparc32_defconfig" if SPARC32
index 0ecd6d76a746f386c350bea66b9c6417022fcbaf..37686828c3d9818a9decfe1b6a396e20161e3d43 100644 (file)
@@ -760,6 +760,9 @@ int dma_supported(struct device *dev, u64 device_mask)
        struct iommu *iommu = dev->archdata.iommu;
        u64 dma_addr_mask = iommu->dma_addr_mask;
 
+       if (device_mask >= (1UL << 32UL))
+               return 0;
+
        if ((device_mask & dma_addr_mask) == dma_addr_mask)
                return 1;
 
index 59c772fedf025651eab00b2c31bad307a8e0ebb0..562fd540e6cedf3b6081c998c09bd6466ab5931f 100644 (file)
@@ -71,28 +71,6 @@ struct iommu_batch {
 static DEFINE_PER_CPU(struct iommu_batch, iommu_batch);
 static int iommu_batch_initialized;
 
-
-unsigned long iommu_getbypass(unsigned long ra,
-                             unsigned long attr,
-                             unsigned long *io_addr_p)
-{
-       struct iommu_batch *p = this_cpu_ptr(&iommu_batch);
-       struct pci_pbm_info *pbm = p->dev->archdata.host_controller;
-       unsigned long devhandle = pbm->devhandle;
-       unsigned long ret;
-
-       ret = pci_sun4v_iommu_getbypass(devhandle, ra, attr, io_addr_p);
-
-       printk(KERN_ERR "iommu_getbypass: devhandle 0x%lx ra 0x%lx prot 0x%lx dma 0x%lx\n",
-                       devhandle, ra, attr, *io_addr_p);
-
-       if (ret)
-               printk(KERN_ERR "iommu_getbypass: err 0x%lx\n", ret);
-
-       return ret;
-}
-EXPORT_SYMBOL(iommu_getbypass);
-
 /* Interrupts must be disabled.  */
 static inline void iommu_batch_start(struct device *dev, unsigned long prot, unsigned long entry)
 {
@@ -287,40 +265,6 @@ static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu,
                free_pages((unsigned long)cpu, order);
 }
 
-static dma_addr_t dma_4v_map_page_bypass(struct device *dev, struct page *page,
-                                        unsigned long offset, size_t sz,
-                                        enum dma_data_direction direction,
-                                        struct dma_attrs *attrs)
-{
-       struct pci_pbm_info *pbm;
-       unsigned long devhandle;
-       unsigned long ra;
-       unsigned long prot;
-       unsigned long dma_addr;
-
-       if (unlikely(direction == DMA_NONE))
-               goto bad;
-
-       prot = HV_PCI_MAP_ATTR_READ;
-       if (direction != DMA_TO_DEVICE)
-               prot |= HV_PCI_MAP_ATTR_WRITE;
-
-       /* VPCI maj=2, min=[0,1] or greater supports relax ordering */
-       if (dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs) && vpci_major >= 2)
-               prot |= HV_PCI_MAP_ATTR_RELAXED_ORDER;
-
-       pbm = dev->archdata.host_controller;
-       devhandle = pbm->devhandle;
-       ra = __pa(page_address(page) + offset);
-       if (pci_sun4v_iommu_getbypass(devhandle, ra, prot, &dma_addr))
-               goto bad;
-
-       return dma_addr;
-
-bad:
-       return DMA_ERROR_CODE;
-}
-
 static dma_addr_t dma_4v_map_page(struct device *dev, struct page *page,
                                  unsigned long offset, size_t sz,
                                  enum dma_data_direction direction,
@@ -336,7 +280,7 @@ static dma_addr_t dma_4v_map_page(struct device *dev, struct page *page,
 
        if (IS_IB_DEVICE(pdev))
                return dma_4v_map_page_bypass(dev, page, offset, sz,
-                                               direction, attrs);
+                                             direction, attrs);
 
        iommu = dev->archdata.iommu;
 
@@ -400,7 +344,7 @@ static void dma_4v_unmap_page(struct device *dev, dma_addr_t bus_addr,
        long entry;
        u32 devhandle;
 
-       /* IB uses bypass, no need to un-map bypass dma address */
+       /* IB uses bypass, no need to unmap for bypass */
        if (IS_IB_DEVICE(pdev))
                return;
 
@@ -422,45 +366,6 @@ static void dma_4v_unmap_page(struct device *dev, dma_addr_t bus_addr,
        iommu_tbl_range_free(&iommu->tbl, bus_addr, npages, IOMMU_ERROR_CODE);
 }
 
-static int dma_4v_map_sg_bypass(struct device *dev, struct scatterlist *sglist,
-                               int nelems, enum dma_data_direction direction,
-                               struct dma_attrs *attrs)
-{
-       struct pci_pbm_info *pbm;
-       unsigned long devhandle;
-       unsigned long ra;
-       unsigned long prot;
-       unsigned long dma_addr;
-       struct scatterlist *s;
-       int i;
-
-       if (unlikely(direction == DMA_NONE))
-               goto bad;
-
-       prot = HV_PCI_MAP_ATTR_READ;
-       if (direction != DMA_TO_DEVICE)
-               prot |= HV_PCI_MAP_ATTR_WRITE;
-
-       /* VPCI maj=2, min=[0,1] or greater supports relax ordering */
-       if (dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs) && vpci_major >= 2)
-               prot |= HV_PCI_MAP_ATTR_RELAXED_ORDER;
-
-       pbm = dev->archdata.host_controller;
-       devhandle = pbm->devhandle;
-       for_each_sg(sglist, s, nelems, i) {
-               ra = (unsigned long)SG_ENT_PHYS_ADDRESS(s);
-               if (pci_sun4v_iommu_getbypass(devhandle, ra, prot, &dma_addr))
-                       goto bad;
-               s->dma_address = dma_addr;
-               s->dma_length = s->length;
-       }
-
-       return nelems;
-
-bad:
-       return 0;
-}
-
 static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
                         int nelems, enum dma_data_direction direction,
                         struct dma_attrs *attrs)
@@ -624,7 +529,7 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
        unsigned long flags, entry;
        u32 devhandle;
 
-       /* IB uses bypass, no need to un-map bypass dma address */
+       /* IB uses bypass, no need to unmap for bypass */
        if (IS_IB_DEVICE(pdev))
                return;
 
index c92eed2609b46dabe8abe155d49cf451705a396e..331abd15861054d6a27260960f31cf919338ee56 100644 (file)
@@ -18,10 +18,6 @@ unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle,
                                     unsigned long tsbid,
                                     unsigned long *io_attributes,
                                     unsigned long *real_address);
-extern unsigned long pci_sun4v_iommu_getbypass(unsigned long dev_hdl,
-                                              unsigned long ra,
-                                              unsigned long attr,
-                                              unsigned long *io_addr_p);
 unsigned long pci_sun4v_config_get(unsigned long devhandle,
                                   unsigned long pci_device,
                                   unsigned long config_offset,
index 80fda5fd4abfaa216054f6cec730eb379ee1297b..ff08066d416120fc84d63aa6d6ba1b3763f1e7ab 100644 (file)
@@ -56,24 +56,6 @@ ENTRY(pci_sun4v_iommu_getmap)
         mov    %o0, %o0
 ENDPROC(pci_sun4v_iommu_getmap)
 
-
-       /* %o0: devhandle
-        * %o1: r_addr
-        * %o2: io_attributes
-        * %o3: &io_addr
-        *
-        * returns: %o0: status
-        */
-ENTRY(pci_sun4v_iommu_getbypass)
-       mov     HV_FAST_PCI_IOMMU_GETBYPASS, %o5
-       ta      HV_FAST_TRAP
-       brnz    %o0, 1f
-       stx     %o1, [%o3]
-1:     retl
-       nop
-ENDPROC(pci_sun4v_iommu_getbypass)
-
-
        /* %o0: devhandle
         * %o1: pci_device
         * %o2: pci_config_offset