Re: [PATCH] RFC: kills consistent_dma_mask

Krzysztof Halasa
2003-08-18T22:00:21Z

"David S. Miller" <davem@redhat.com> writes:

> drivers/net/tg3.c

No... I know of tg3.c:

/* Configure DMA attributes. */
if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) {
pci_using_dac = 1;
if (pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL)) {
printk(KERN_ERR PFX "Unable to obtain 64 bit DMA "
"for consistent allocations\n");
goto err_out_free_res;
}
} else {
err = pci_set_dma_mask(pdev, (u64) 0xffffffff);
if (err) {
printk(KERN_ERR PFX "No usable DMA configuration, "
"aborting.\n");
goto err_out_free_res;
}
pci_using_dac = 0;
}

As you can see it tg3 uses consistent_dma_mask = dma_mask so this one
doesn't need two masks.

Ok, I assume there is a real need for two masks. Still, having different
archs rely on different variables for the same task is a bug which needs
fixing.

Example:

$ grep DMA_MASK sound/oss/emu10k1/main.c
#define EMU10K1_DMA_MASK 0x1fffffff /* DMA buffer mask for pci_alloc_consist */
if (pci_set_dma_mask(pci_dev, EMU10K1_DMA_MASK)) {

Do you see a problem here? It will work if and only if pci_alloc_consistent
uses dma_mask rather than consistent_dma_mask.

Ok, I will make a patch which uses consistent_dma_mask for consistent allocs
on all archs. This will break drivers but they are already broken on
x86-64 and ia64, and it's easier to fix drivers than to write them when
the core is faulty.

Hope that it is ok?
--
Krzysztof Halasa
Network Administrator