Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2be62149 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

x86: dma-ops on highmem fix



Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 4d92fbf2
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -4,12 +4,12 @@
#include <linux/dma-mapping.h>
#include <linux/dma-mapping.h>
#include <asm/dma-mapping.h>
#include <asm/dma-mapping.h>


static dma_addr_t pci32_map_single(struct device *dev, void *ptr,
static dma_addr_t pci32_map_single(struct device *dev, phys_addr_t ptr,
				   size_t size, int direction)
				   size_t size, int direction)
{
{
	WARN_ON(size == 0);
	WARN_ON(size == 0);
	flush_write_buffers();
	flush_write_buffers();
	return virt_to_phys(ptr);
	return ptr;
}
}


static int pci32_dma_map_sg(struct device *dev, struct scatterlist *sglist,
static int pci32_dma_map_sg(struct device *dev, struct scatterlist *sglist,
+2 −1
Original line number Original line Diff line number Diff line
@@ -470,10 +470,11 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
	return 0;
	return 0;
}
}


static dma_addr_t calgary_map_single(struct device *dev, void *vaddr,
static dma_addr_t calgary_map_single(struct device *dev, phys_addr_t paddr,
	size_t size, int direction)
	size_t size, int direction)
{
{
	dma_addr_t dma_handle = bad_dma_address;
	dma_addr_t dma_handle = bad_dma_address;
	void *vaddr = phys_to_virt(paddr);
	unsigned long uaddr;
	unsigned long uaddr;
	unsigned int npages;
	unsigned int npages;
	struct iommu_table *tbl = find_iommu_table(dev);
	struct iommu_table *tbl = find_iommu_table(dev);
+1 −1
Original line number Original line Diff line number Diff line
@@ -141,7 +141,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
	}
	}


	if (dma_ops->map_simple) {
	if (dma_ops->map_simple) {
		*dma_handle = dma_ops->map_simple(dev, memory,
		*dma_handle = dma_ops->map_simple(dev, virt_to_phys(memory),
					      size,
					      size,
					      PCI_DMA_BIDIRECTIONAL);
					      PCI_DMA_BIDIRECTIONAL);
		if (*dma_handle != bad_dma_address)
		if (*dma_handle != bad_dma_address)
+7 −8
Original line number Original line Diff line number Diff line
@@ -264,9 +264,9 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
}
}


static dma_addr_t
static dma_addr_t
gart_map_simple(struct device *dev, char *buf, size_t size, int dir)
gart_map_simple(struct device *dev, phys_addr_t paddr, size_t size, int dir)
{
{
	dma_addr_t map = dma_map_area(dev, virt_to_bus(buf), size, dir);
	dma_addr_t map = dma_map_area(dev, paddr, size, dir);


	flush_gart();
	flush_gart();


@@ -275,18 +275,17 @@ gart_map_simple(struct device *dev, char *buf, size_t size, int dir)


/* Map a single area into the IOMMU */
/* Map a single area into the IOMMU */
static dma_addr_t
static dma_addr_t
gart_map_single(struct device *dev, void *addr, size_t size, int dir)
gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir)
{
{
	unsigned long phys_mem, bus;
	unsigned long bus;


	if (!dev)
	if (!dev)
		dev = &fallback_dev;
		dev = &fallback_dev;


	phys_mem = virt_to_phys(addr);
	if (!need_iommu(dev, paddr, size))
	if (!need_iommu(dev, phys_mem, size))
		return paddr;
		return phys_mem;


	bus = gart_map_simple(dev, addr, size, dir);
	bus = gart_map_simple(dev, paddr, size, dir);


	return bus;
	return bus;
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -26,10 +26,10 @@ check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
}
}


static dma_addr_t
static dma_addr_t
nommu_map_single(struct device *hwdev, void *ptr, size_t size,
nommu_map_single(struct device *hwdev, phys_addr_t paddr, size_t size,
	       int direction)
	       int direction)
{
{
	dma_addr_t bus = virt_to_bus(ptr);
	dma_addr_t bus = paddr;
	if (!check_addr("map_single", hwdev, bus, size))
	if (!check_addr("map_single", hwdev, bus, size))
				return bad_dma_address;
				return bad_dma_address;
	return bus;
	return bus;
Loading