ia64/xen-unstable

changeset 9712:f4285d150d3a

Must use __copy_to_user_inatomic() in swiotlb's sync_single()
function, as we cannot sleep there.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Apr 14 11:58:11 2006 +0100 (2006-04-14)
parents ec4f87e98fc1
children 2ccaa3879417
files linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Thu Apr 13 19:14:11 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Fri Apr 14 11:58:11 2006 +0100
     1.3 @@ -206,8 +206,8 @@ swiotlb_init(void)
     1.4  }
     1.5  
     1.6  /*
     1.7 - * We use __copy_to_user to transfer to the host buffer because the buffer
     1.8 - * may be mapped read-only (e.g, in blkback driver) but lower-level
     1.9 + * We use __copy_to_user_inatomic to transfer to the host buffer because the
    1.10 + * buffer may be mapped read-only (e.g, in blkback driver) but lower-level
    1.11   * drivers map the buffer for DMA_BIDIRECTIONAL access. This causes an
    1.12   * unnecessary copy from the aperture to the host buffer, and a page fault.
    1.13   */
    1.14 @@ -225,7 +225,7 @@ static void
    1.15  			dev  = dma_addr + size - len;
    1.16  			host = kmp + buffer.offset;
    1.17  			if (dir == DMA_FROM_DEVICE) {
    1.18 -				if (__copy_to_user(host, dev, bytes))
    1.19 +				if (__copy_to_user_inatomic(host, dev, bytes))
    1.20  					/* inaccessible */;
    1.21  			} else
    1.22  				memcpy(dev, host, bytes);
    1.23 @@ -238,7 +238,7 @@ static void
    1.24  		char *host = (char *)phys_to_virt(
    1.25  			page_to_pseudophys(buffer.page)) + buffer.offset;
    1.26  		if (dir == DMA_FROM_DEVICE) {
    1.27 -			if (__copy_to_user(host, dma_addr, size))
    1.28 +			if (__copy_to_user_inatomic(host, dma_addr, size))
    1.29  				/* inaccessible */;
    1.30  		} else if (dir == DMA_TO_DEVICE)
    1.31  			memcpy(dma_addr, host, size);