Re: [PATCH] x86-64: dma_ops for DMA mapping - K3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 06, 2005 at 04:59:47PM +0200, Matti Aarnio wrote:
> On Sun, Nov 06, 2005 at 03:11:12PM +0200, Muli Ben-Yehuda wrote:
> > Hi Andi,
> > 
> > Here's the latest version of the dma_ops patch, updated to address
> > your comments. The patch is against Linus's tree as of a few minutes
> > ago and applies cleanly to 2.6.14-git9. Tested on AMD64 with gart,
> > swiotlb, nommu and iommu=off. There are still a few cleanups left, but
> > I'd appreciate it if this could see wider testing at this
> > stage. Please apply...
> 
>   Works mostly.
> There is some problem which I am not sure of is it related
> to this at all or not.  BUG report attached below.

I think this is the same problem as the one referenced in this thread:
http://marc.theaimsgroup.com/?l=linux-kernel&m=113063216900541&w=2 
which predates my changes. The error message looks different
because the "no IOMMU" code path now goes through nommu, rather than
gart with no_iommu set, but it appears to be the same underlying
problem. Can you please send me your vmlinux and / or apply this debug
patch and post the results to verify?

Thanks,
Muli

Exporting patch:
# HG changeset patch
# User Muli Ben-Yehuda <[email protected]>
# Node ID 64c901d4194adab05d2401208bb24e69d9993dba
# Parent  d75ad581e6f925a389f7f69bf3ec725459c77f9f
debug patch for Matti Aarnio

diff -r d75ad581e6f925a389f7f69bf3ec725459c77f9f -r 64c901d4194adab05d2401208bb24e69d9993dba drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c	Sun Nov  6 10:08:10 2005
+++ b/drivers/usb/core/hcd.c	Sun Nov  6 15:48:07 2005
@@ -1183,14 +1183,32 @@
 	 */
 	if (hcd->self.controller->dma_mask) {
 		if (usb_pipecontrol (urb->pipe)
-			&& !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP))
+		    && !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP)) {
+			printk("%s: calling dma_map_single(direction = %d, "
+			       "ptr = %p, virt_to_bus(ptr) = 0x%lx, "
+			       "size = %d, hwdev->dma_mask = 0x%Lx)\n",
+			       __func__, DMA_TO_DEVICE,
+			       urb->setup_packet, 
+			       virt_to_bus(urb->setup_packet),
+			       (int)sizeof(struct usb_ctrlrequest),
+			       *hcd->self.controller->dma_mask);
 			urb->setup_dma = dma_map_single (
 					hcd->self.controller,
 					urb->setup_packet,
 					sizeof (struct usb_ctrlrequest),
 					DMA_TO_DEVICE);
+		}
 		if (urb->transfer_buffer_length != 0
 			&& !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP))
+			printk("%s: calling dma_map_single(direction = %d, "
+			       "ptr = %p, virt_to_bus(ptr) = 0x%lx, "
+			       "size = %d, hwdev->dma_mask = 0x%Lx)\n",
+			       __func__, (usb_pipein (urb->pipe) ? 
+                               DMA_FROM_DEVICE : DMA_TO_DEVICE),
+			       urb->transfer_buffer,
+			       virt_to_bus(urb->transfer_buffer),
+			       urb->transfer_buffer_length,
+			       *hcd->self.controller->dma_mask);
 			urb->transfer_dma = dma_map_single (
 					hcd->self.controller,
 					urb->transfer_buffer,
diff -r d75ad581e6f925a389f7f69bf3ec725459c77f9f -r 64c901d4194adab05d2401208bb24e69d9993dba include/asm-x86_64/nommu-mapping.h
--- a/include/asm-x86_64/nommu-mapping.h	Sun Nov  6 10:08:10 2005
+++ b/include/asm-x86_64/nommu-mapping.h	Sun Nov  6 15:48:07 2005
@@ -21,8 +21,13 @@
 		out_of_line_bug();
 	addr = virt_to_bus(ptr);
 
-	if ((addr+size) & ~*hwdev->dma_mask)
+	if ((addr+size) & ~*hwdev->dma_mask) {
+		printk("%s: addr 0x%Lx, size %d, ~mask 0x%Lx, "
+		       "(addr+size) & ~*hwdev->dma_mask = 0x%lx\n",
+		       __func__, addr, (int)size, ~*hwdev->dma_mask,
+		       (addr+size) & ~*hwdev->dma_mask);
 		out_of_line_bug();
+	}
 	return addr;
 }
 

-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux