]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
Must use __copy_to_user_inatomic() in swiotlb's sync_single()
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 14 Apr 2006 11:04:41 +0000 (12:04 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 14 Apr 2006 11:04:41 +0000 (12:04 +0100)
function, as we cannot sleep there.

Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c

index e493e345c54d237967a6e32df9a1c0e3a762a85c..9c23eb311023c8bd19c5ebeb9938d764394f197f 100644 (file)
@@ -206,8 +206,8 @@ swiotlb_init(void)
 }
 
 /*
- * We use __copy_to_user to transfer to the host buffer because the buffer
- * may be mapped read-only (e.g, in blkback driver) but lower-level
+ * We use __copy_to_user_inatomic to transfer to the host buffer because the
+ * buffer may be mapped read-only (e.g, in blkback driver) but lower-level
  * drivers map the buffer for DMA_BIDIRECTIONAL access. This causes an
  * unnecessary copy from the aperture to the host buffer, and a page fault.
  */
@@ -225,7 +225,7 @@ __sync_single(struct phys_addr buffer, char *dma_addr, size_t size, int dir)
                        dev  = dma_addr + size - len;
                        host = kmp + buffer.offset;
                        if (dir == DMA_FROM_DEVICE) {
-                               if (__copy_to_user(host, dev, bytes))
+                               if (__copy_to_user_inatomic(host, dev, bytes))
                                        /* inaccessible */;
                        } else
                                memcpy(dev, host, bytes);
@@ -238,7 +238,7 @@ __sync_single(struct phys_addr buffer, char *dma_addr, size_t size, int dir)
                char *host = (char *)phys_to_virt(
                        page_to_pseudophys(buffer.page)) + buffer.offset;
                if (dir == DMA_FROM_DEVICE) {
-                       if (__copy_to_user(host, dma_addr, size))
+                       if (__copy_to_user_inatomic(host, dma_addr, size))
                                /* inaccessible */;
                } else if (dir == DMA_TO_DEVICE)
                        memcpy(dma_addr, host, size);