linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Stop pci_set_dma_mask() from failing when RAM doesn't exceed the mask anyway
@ 2009-07-31 19:41 David Woodhouse
  2009-07-31 22:25 ` Benjamin Herrenschmidt
  2009-08-10  6:46 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 9+ messages in thread
From: David Woodhouse @ 2009-07-31 19:41 UTC (permalink / raw)
  To: linuxppc-dev

On an iMac G5, the b43 driver is failing to initialise because trying to
set the dma mask to 30-bit fails. Even though there's only 512MiB of RAM
in the machine anyway:
	https://bugzilla.redhat.com/show_bug.cgi?id=514787

We should probably let it succeed if the available RAM in the system
doesn't exceed the requested limit.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 20a60d6..1769a8e 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -90,11 +90,11 @@ static void dma_direct_unmap_sg(struct device *dev,
struct scatterlist *sg,
 static int dma_direct_dma_supported(struct device *dev, u64 mask)
 {
 #ifdef CONFIG_PPC64
-	/* Could be improved to check for memory though it better be
-	 * done via some global so platforms can set the limit in case
+	extern unsigned long highest_memmap_pfn;
+	/* Could be improved so platforms can set the limit in case
 	 * they have limited DMA windows
 	 */
-	return mask >= DMA_BIT_MASK(32);
+	return (mask >> PAGE_SHIFT) >= highest_memmap_pfn;
 #else
 	return 1;
 #endif

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-08-10  6:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-31 19:41 [PATCH] Stop pci_set_dma_mask() from failing when RAM doesn't exceed the mask anyway David Woodhouse
2009-07-31 22:25 ` Benjamin Herrenschmidt
2009-08-01  7:54   ` David Woodhouse
2009-08-01  8:00     ` Benjamin Herrenschmidt
2009-08-01  9:00       ` David Woodhouse
2009-08-02  7:50         ` Benjamin Herrenschmidt
2009-08-03 13:14           ` David Woodhouse
2009-08-03 21:05             ` Benjamin Herrenschmidt
2009-08-10  6:46 ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).