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

RE: [Xen-devel] [PATCH] Retry 3: Use i386 swiotlb code in lib/swiotlb-xen.c [2/2]


  • To: "Jan Beulich" <jbeulich@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: "Langsdorf, Mark" <mark.langsdorf@xxxxxxx>
  • Date: Tue, 27 Feb 2007 14:30:46 -0600
  • Delivery-date: Tue, 27 Feb 2007 12:30:07 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcdaSiv8kB5VtWIdQCaba/SK/GMXNAAY56LA
  • Thread-topic: [Xen-devel] [PATCH] Retry 3: Use i386 swiotlb code in lib/swiotlb-xen.c [2/2]

> >>> "Langsdorf, Mark" <mark.langsdorf@xxxxxxx> 26.02.07 21:37 >>>
> >Move the arch/i386/kernel/swiotlb.c code to lib/swiotlb-xen.c
> >code in order to simplify maintenance of Xen in the future.
> >
> >The first patch simply moves the code to lib/swiotlb-xen.c;
> 
> Without the lib/Makefile adjustment the first patch can't work without
> the second one.

Okay.
 
> >--- a/linux-2.6-xen-sparse/lib/swiotlb-xen.c Mon Feb 26 
> 15:52:16 2007 -0600
> >+++ b/linux-2.6-xen-sparse/lib/swiotlb-xen.c Mon Feb 26 
> 15:58:43 2007 -0600
> >...
> >+void
> >+swiotlb_free_coherent(struct device *hwdev, size_t size, 
> void *vaddr,
> >+                    dma_addr_t dma_handle)
> >+{
> >+    if (in_swiotlb_aperture((dma_addr_t) vaddr))
> >+            free_pages((unsigned long) vaddr, get_order(size));
> >+    else
> >+            /* DMA_TO_DEVICE to avoid memcpy in unmap_single */
> >+            swiotlb_unmap_single (hwdev, dma_handle, size, 
> DMA_TO_DEVICE);
> >+}
> 
> I'm pretty certain this is wrong: dma_handle is what should be passed
> to in_swiotlb_aperture().

The original code is 
        if (!(vaddr >= (void *)io_tlb_start) && vaddr < (void *)
io_tlb_end))
                free_pages((unsigned long) vaddr, get_order(size));

I can't see why I wouldn't check the vaddr address in Xen, also.

-Mark Langsdorf
AMD, Inc.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.