public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* highmem pci dma mapping does not work, missing cast in asm-i386/pci.h
@ 2002-06-10 23:56 Benjamin LaHaise
  2002-06-23 15:39 ` Jes Sorensen
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin LaHaise @ 2002-06-10 23:56 UTC (permalink / raw)
  To: Marcelo Tosatti, Linux Kernel

Hello all,

There's a missing cast in pci_map_page that causes 64 bit capable 
drivers to access the wrong memory for highmem pages.  Please 
include the patch below to fix it.

		-ben
-- 
"You will be reincarnated as a toad; and you will be much happier."

:r ~/patches/v2.4/v2.4.19-pre10-pci_highmem.diff
diff -urN v2.4.19-pre10/include/asm-i386/pci.h pci-v2.4.19-pre10/include/asm-i386/pci.h
--- v2.4.19-pre10/include/asm-i386/pci.h	Thu Jun  6 20:10:08 2002
+++ pci-v2.4.19-pre10/include/asm-i386/pci.h	Mon Jun 10 19:54:16 2002
@@ -103,7 +103,7 @@
 	if (direction == PCI_DMA_NONE)
 		out_of_line_bug();
 
-	return (page - mem_map) * PAGE_SIZE + offset;
+	return (dma_addr_t)(page - mem_map) * PAGE_SIZE + offset;
 }
 
 static inline void pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,

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

* Re: highmem pci dma mapping does not work, missing cast in asm-i386/pci.h
  2002-06-10 23:56 highmem pci dma mapping does not work, missing cast in asm-i386/pci.h Benjamin LaHaise
@ 2002-06-23 15:39 ` Jes Sorensen
  0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2002-06-23 15:39 UTC (permalink / raw)
  To: Benjamin LaHaise; +Cc: Marcelo Tosatti, Linux Kernel, torvalds

>>>>> "Ben" == Benjamin LaHaise <bcrl@redhat.com> writes:

Ben> Hello all, There's a missing cast in pci_map_page that causes 64
Ben> bit capable drivers to access the wrong memory for highmem pages.
Ben> Please include the patch below to fix it.

Looking at this one, I believe we need to do the same for
page_to_phys() - either by using dma_addr_t as the type or explicitly
going u64 #ifdef CONFIG_HIGHMEM.

Patch using dma_addr_t included relative to 2.4.18.

Btw. I noticed that in 2.5.24/ia32 we use CONFIG_HIGHMEM to declare
dma_addr_t as 64 bit but CONFIG_HIGHMEM64G to handle page_to_phys. Is
this just an oversight or on purpose?

Comments?

Jes


--- include/asm-i386/io.h~	Sun Jun 23 11:29:26 2002
+++ include/asm-i386/io.h	Sun Jun 23 11:30:17 2002
@@ -2,6 +2,7 @@
 #define _ASM_IO_H
 
 #include <linux/config.h>
+#include <asm/types.h>
 
 /*
  * This file contains the definitions for the x86 IO instructions
@@ -76,7 +77,7 @@
 /*
  * Change "struct page" to physical address.
  */
-#define page_to_phys(page)	((page - mem_map) << PAGE_SHIFT)
+#define page_to_phys(page)	((dma_addr_t)(page - mem_map) << PAGE_SHIFT)
 
 extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
 

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

end of thread, other threads:[~2002-06-23 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-10 23:56 highmem pci dma mapping does not work, missing cast in asm-i386/pci.h Benjamin LaHaise
2002-06-23 15:39 ` Jes Sorensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox