summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/pci-dma.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-03-19 11:38:14 +0100
committerIngo Molnar <mingo@kernel.org>2018-03-20 10:01:56 +0100
commit038d07a283d62336b32cc23b62aecdf9418cfc11 (patch)
treef47625ddf15e599aca16e56262b37968bd3a1779 /arch/x86/kernel/pci-dma.c
parent3eb93ea3272d428aab3c03e2dd272a78a7729ba8 (diff)
x86/dma: Remove dma_alloc_coherent_mask()
These days all devices (including the ISA fallback device) have a coherent DMA mask set, so remove the workaround. Tested-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Joerg Roedel <joro@8bytes.org> Cc: Jon Mason <jdmason@kudzu.us> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Muli Ben-Yehuda <mulix@mulix.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: iommu@lists.linux-foundation.org Link: http://lkml.kernel.org/r/20180319103826.12853-3-hch@lst.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/pci-dma.c')
-rw-r--r--arch/x86/kernel/pci-dma.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index df7ab02f959f..b59820872ec7 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -80,13 +80,10 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_addr, gfp_t flag,
unsigned long attrs)
{
- unsigned long dma_mask;
struct page *page;
unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
dma_addr_t addr;
- dma_mask = dma_alloc_coherent_mask(dev, flag);
-
again:
page = NULL;
/* CMA can be used only in the context which permits sleeping */
@@ -95,7 +92,7 @@ again:
flag);
if (page) {
addr = phys_to_dma(dev, page_to_phys(page));
- if (addr + size > dma_mask) {
+ if (addr + size > dev->coherent_dma_mask) {
dma_release_from_contiguous(dev, page, count);
page = NULL;
}
@@ -108,10 +105,11 @@ again:
return NULL;
addr = phys_to_dma(dev, page_to_phys(page));
- if (addr + size > dma_mask) {
+ if (addr + size > dev->coherent_dma_mask) {
__free_pages(page, get_order(size));
- if (dma_mask < DMA_BIT_MASK(32) && !(flag & GFP_DMA)) {
+ if (dev->coherent_dma_mask < DMA_BIT_MASK(32) &&
+ !(flag & GFP_DMA)) {
flag = (flag & ~GFP_DMA32) | GFP_DMA;
goto again;
}