From: Chuck Anderson Date: Sun, 27 Nov 2016 22:04:53 +0000 (-0800) Subject: Merge branch topic/uek-4.1/upstream-cherry-picks of git://ca-git.us.oracle.com/linux... X-Git-Tag: v4.1.12-92~32 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=08150ba62c20caa5c42d88365789888280a9e07c;p=users%2Fjedix%2Flinux-maple.git Merge branch topic/uek-4.1/upstream-cherry-picks of git://ca-git.us.oracle.com/linux-uek into uek/uek-4.1 * topic/uek-4.1/upstream-cherry-picks: mm/hugetlb: hugetlb_no_page: rate-limit warning message net/vxlan: Fix kernel unaligned access in __vxlan_find_mac kexec: align crash_notes allocation to make it be inside one physical page iommu-common: Fix error code used in iommu_tbl_range_{alloc,free}(). --- 08150ba62c20caa5c42d88365789888280a9e07c diff --cc arch/sparc/kernel/pci_sun4v.c index d2a34ea80a7d,836e8cef47e2..b940e16e6a30 --- a/arch/sparc/kernel/pci_sun4v.c +++ b/arch/sparc/kernel/pci_sun4v.c @@@ -411,48 -317,9 +411,48 @@@ static void dma_4v_unmap_page(struct de bus_addr &= IO_PAGE_MASK; entry = (bus_addr - iommu->tbl.table_map_base) >> IO_PAGE_SHIFT; dma_4v_iommu_demap(&devhandle, entry, npages); - iommu_tbl_range_free(&iommu->tbl, bus_addr, npages, DMA_ERROR_CODE); + 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; + + BUG_ON(!dev); + pbm = dev->archdata.host_controller; + BUG_ON(!pbm); + devhandle = pbm->devhandle; + + if (unlikely(direction == DMA_NONE)) + goto bad; + + prot = HV_PCI_MAP_ATTR_READ; + + if (direction != DMA_TO_DEVICE) + prot |= HV_PCI_MAP_ATTR_WRITE; + + 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)