mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 01:04:19 +08:00
Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
* 'sg' of git://git.kernel.dk/linux-2.6-block: sparc64: zero out dma_length fvr32: fixup dma-mapping for new sg layout sh/sh64: fixup dma-mapping for new sg layout Fix sctp compile m68knommu: remove sg_address() frv: update comment in scatterlist to reflect new setup blackfin: remove sg_address() arm: sg fallout mips: sg_page() fallout alpha: sg_virt() fallout intel-iommu: fix sg_page() parisc: fix sg_page() fallout ide: build fix net: fix xfrm build - missing scatterlist.h include [BLOCK] blk_rq_map_sg: force clear termination bit [BLOCK] Don't clear sg_dma_len/addr() in blk_rq_map_sg() s390 zfcp: sg fixups powerpc: Fix fallout from sg_page() changes IB/ehca: Fix sg_page() fallout arm: build fix
This commit is contained in:
commit
ba1c28a943
@ -7,6 +7,7 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/log2.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/dmapool.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <asm/cacheflush.h>
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <asm/cache.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/dma.h> /* for DMA_CHUNK_SIZE */
|
||||
|
@ -233,6 +233,11 @@ unsigned long prepare_sg(struct scatterlist *sg, int nents)
|
||||
dma_sg->dma_address = dent_addr;
|
||||
dma_sg->dma_length = dent_len;
|
||||
|
||||
if (dma_sg != sg) {
|
||||
dma_sg = next_sg(dma_sg);
|
||||
dma_sg->dma_length = 0;
|
||||
}
|
||||
|
||||
return ((unsigned long) dent_addr +
|
||||
(unsigned long) dent_len +
|
||||
(IO_PAGE_SIZE - 1UL)) >> IO_PAGE_SHIFT;
|
||||
|
@ -1351,11 +1351,21 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
|
||||
new_segment:
|
||||
if (!sg)
|
||||
sg = sglist;
|
||||
else
|
||||
else {
|
||||
/*
|
||||
* If the driver previously mapped a shorter
|
||||
* list, we could see a termination bit
|
||||
* prematurely unless it fully inits the sg
|
||||
* table on each mapping. We KNOW that there
|
||||
* must be more entries here or the driver
|
||||
* would be buggy, so force clear the
|
||||
* termination bit to avoid doing a full
|
||||
* sg_init_table() in drivers for each command.
|
||||
*/
|
||||
sg->page_link &= ~0x02;
|
||||
sg = sg_next(sg);
|
||||
}
|
||||
|
||||
sg_dma_len(sg) = 0;
|
||||
sg_dma_address(sg) = 0;
|
||||
sg_set_page(sg, bvec->bv_page);
|
||||
sg->length = nbytes;
|
||||
sg->offset = bvec->bv_offset;
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/irq.h>
|
||||
|
@ -1776,7 +1776,7 @@ static int ehca_set_pagebuf_user1(struct ehca_mr_pginfo *pginfo,
|
||||
list_for_each_entry_continue(
|
||||
chunk, (&(pginfo->u.usr.region->chunk_list)), list) {
|
||||
for (i = pginfo->u.usr.next_nmap; i < chunk->nmap; ) {
|
||||
pgaddr = page_to_pfn(chunk->page_list[i].page)
|
||||
pgaddr = page_to_pfn(sg_page(&chunk->page_list[i]))
|
||||
<< PAGE_SHIFT ;
|
||||
*kpage = phys_to_abs(pgaddr +
|
||||
(pginfo->next_hwpage *
|
||||
@ -1832,7 +1832,7 @@ static int ehca_check_kpages_per_ate(struct scatterlist *page_list,
|
||||
{
|
||||
int t;
|
||||
for (t = start_idx; t <= end_idx; t++) {
|
||||
u64 pgaddr = page_to_pfn(page_list[t].page) << PAGE_SHIFT;
|
||||
u64 pgaddr = page_to_pfn(sg_page(&page_list[t])) << PAGE_SHIFT;
|
||||
ehca_gen_dbg("chunk_page=%lx value=%016lx", pgaddr,
|
||||
*(u64 *)abs_to_virt(phys_to_abs(pgaddr)));
|
||||
if (pgaddr - PAGE_SIZE != *prev_pgaddr) {
|
||||
@ -1867,7 +1867,7 @@ static int ehca_set_pagebuf_user2(struct ehca_mr_pginfo *pginfo,
|
||||
chunk, (&(pginfo->u.usr.region->chunk_list)), list) {
|
||||
for (i = pginfo->u.usr.next_nmap; i < chunk->nmap; ) {
|
||||
if (nr_kpages == kpages_per_hwpage) {
|
||||
pgaddr = ( page_to_pfn(chunk->page_list[i].page)
|
||||
pgaddr = ( page_to_pfn(sg_page(&chunk->page_list[i]))
|
||||
<< PAGE_SHIFT );
|
||||
*kpage = phys_to_abs(pgaddr);
|
||||
if ( !(*kpage) ) {
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/cache.h> /* for L1_CACHE_BYTES */
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -1962,7 +1962,7 @@ static void intel_free_coherent(struct device *hwdev, size_t size,
|
||||
free_pages((unsigned long)vaddr, order);
|
||||
}
|
||||
|
||||
#define SG_ENT_VIRT_ADDRESS(sg) (page_address((sg)->page) + (sg)->offset)
|
||||
#define SG_ENT_VIRT_ADDRESS(sg) (sg_virt((sg)))
|
||||
static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist,
|
||||
int nelems, int dir)
|
||||
{
|
||||
@ -2010,7 +2010,7 @@ static int intel_nontranslate_map_sg(struct device *hddev,
|
||||
struct scatterlist *sg;
|
||||
|
||||
for_each_sg(sglist, sg, nelems, i) {
|
||||
BUG_ON(!sg->page);
|
||||
BUG_ON(!sg_page(sg));
|
||||
sg->dma_address = virt_to_bus(SG_ENT_VIRT_ADDRESS(sg));
|
||||
sg->dma_length = sg->length;
|
||||
}
|
||||
|
@ -559,6 +559,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t size)
|
||||
retval = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
sg_init_table(sg_list->sg, sg_list->count);
|
||||
|
||||
for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++) {
|
||||
sg->length = min(size, PAGE_SIZE);
|
||||
|
@ -63,7 +63,7 @@
|
||||
static inline void *
|
||||
zfcp_sg_to_address(struct scatterlist *list)
|
||||
{
|
||||
return (void *) (page_address(list->page) + list->offset);
|
||||
return sg_virt(list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,7 +74,7 @@ zfcp_sg_to_address(struct scatterlist *list)
|
||||
static inline void
|
||||
zfcp_address_to_sg(void *address, struct scatterlist *list)
|
||||
{
|
||||
list->page = virt_to_page(address);
|
||||
sg_set_page(list, virt_to_page(address));
|
||||
list->offset = ((unsigned long) address) & (PAGE_SIZE - 1);
|
||||
}
|
||||
|
||||
|
@ -308,13 +308,15 @@ zfcp_erp_adisc(struct zfcp_port *port)
|
||||
if (send_els == NULL)
|
||||
goto nomem;
|
||||
|
||||
send_els->req = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC);
|
||||
send_els->req = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
|
||||
if (send_els->req == NULL)
|
||||
goto nomem;
|
||||
sg_init_table(send_els->req, 1);
|
||||
|
||||
send_els->resp = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC);
|
||||
send_els->resp = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
|
||||
if (send_els->resp == NULL)
|
||||
goto nomem;
|
||||
sg_init_table(send_els->resp, 1);
|
||||
|
||||
address = (void *) get_zeroed_page(GFP_ATOMIC);
|
||||
if (address == NULL)
|
||||
@ -363,7 +365,7 @@ zfcp_erp_adisc(struct zfcp_port *port)
|
||||
retval = -ENOMEM;
|
||||
freemem:
|
||||
if (address != NULL)
|
||||
__free_pages(send_els->req->page, 0);
|
||||
__free_pages(sg_page(send_els->req), 0);
|
||||
if (send_els != NULL) {
|
||||
kfree(send_els->req);
|
||||
kfree(send_els->resp);
|
||||
@ -437,7 +439,7 @@ zfcp_erp_adisc_handler(unsigned long data)
|
||||
|
||||
out:
|
||||
zfcp_port_put(port);
|
||||
__free_pages(send_els->req->page, 0);
|
||||
__free_pages(sg_page(send_els->req), 0);
|
||||
kfree(send_els->req);
|
||||
kfree(send_els->resp);
|
||||
kfree(send_els);
|
||||
|
@ -147,7 +147,7 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *cmd, void *buf)
|
||||
|
||||
req_len = fin = 0;
|
||||
scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) {
|
||||
kaddr = kmap_atomic(sg_page(sgpnt->page), KM_IRQ0);
|
||||
kaddr = kmap_atomic(sg_page(sgpnt), KM_IRQ0);
|
||||
len = sgpnt->length;
|
||||
if ((req_len + len) > buflen) {
|
||||
len = buflen - req_len;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include <linux/mm.h> /* need struct page */
|
||||
|
||||
#include <asm/scatterlist.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
||||
/*
|
||||
* DMA-consistent mapping functions. These allocate/free a region of
|
||||
@ -274,8 +274,8 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
|
||||
for (i = 0; i < nents; i++, sg++) {
|
||||
char *virt;
|
||||
|
||||
sg->dma_address = page_to_dma(dev, sg->page) + sg->offset;
|
||||
virt = page_address(sg->page) + sg->offset;
|
||||
sg->dma_address = page_to_dma(dev, sg_page(sg)) + sg->offset;
|
||||
virt = sg_virt(sg);
|
||||
|
||||
if (!arch_is_coherent())
|
||||
dma_cache_maint(virt, sg->length, dir);
|
||||
@ -371,7 +371,7 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nents; i++, sg++) {
|
||||
char *virt = page_address(sg->page) + sg->offset;
|
||||
char *virt = sg_virt(sg);
|
||||
if (!arch_is_coherent())
|
||||
dma_cache_maint(virt, sg->length, dir);
|
||||
}
|
||||
@ -384,7 +384,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nents; i++, sg++) {
|
||||
char *virt = page_address(sg->page) + sg->offset;
|
||||
char *virt = sg_virt(sg);
|
||||
if (!arch_is_coherent())
|
||||
dma_cache_maint(virt, sg->length, dir);
|
||||
}
|
||||
|
@ -217,8 +217,8 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
|
||||
for (i = 0; i < nents; i++) {
|
||||
char *virt;
|
||||
|
||||
sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
|
||||
virt = page_address(sg[i].page) + sg[i].offset;
|
||||
sg[i].dma_address = page_to_bus(sg_page(&sg[i])) + sg[i].offset;
|
||||
virt = sg_virt(&sg[i]);
|
||||
dma_cache_sync(dev, virt, sg[i].length, direction);
|
||||
}
|
||||
|
||||
@ -327,8 +327,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nents; i++) {
|
||||
dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
|
||||
sg[i].length, direction);
|
||||
dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, direction);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ struct scatterlist {
|
||||
* returns, or alternatively stop on the first sg_dma_len(sg) which
|
||||
* is 0.
|
||||
*/
|
||||
#define sg_address(sg) (page_address((sg)->page) + (sg)->offset)
|
||||
#define sg_dma_address(sg) ((sg)->dma_address)
|
||||
#define sg_dma_len(sg) ((sg)->length)
|
||||
|
||||
|
@ -4,19 +4,19 @@
|
||||
#include <asm/types.h>
|
||||
|
||||
/*
|
||||
* Drivers must set either ->address or (preferred) ->page and ->offset
|
||||
* Drivers must set either ->address or (preferred) page and ->offset
|
||||
* to indicate where data must be transferred to/from.
|
||||
*
|
||||
* Using ->page is recommended since it handles highmem data as well as
|
||||
* Using page is recommended since it handles highmem data as well as
|
||||
* low mem. ->address is restricted to data which has a virtual mapping, and
|
||||
* it will go away in the future. Updating to ->page can be automated very
|
||||
* it will go away in the future. Updating to page can be automated very
|
||||
* easily -- something like
|
||||
*
|
||||
* sg->address = some_ptr;
|
||||
*
|
||||
* can be rewritten as
|
||||
*
|
||||
* sg->page = virt_to_page(some_ptr);
|
||||
* sg_set_page(virt_to_page(some_ptr));
|
||||
* sg->offset = (unsigned long) some_ptr & ~PAGE_MASK;
|
||||
*
|
||||
* and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
|
||||
|
@ -14,7 +14,6 @@ struct scatterlist {
|
||||
unsigned int length;
|
||||
};
|
||||
|
||||
#define sg_address(sg) (page_address((sg)->page) + (sg)->offset)
|
||||
#define sg_dma_address(sg) ((sg)->dma_address)
|
||||
#define sg_dma_len(sg) ((sg)->length)
|
||||
|
||||
|
@ -18,7 +18,7 @@ struct scatterlist {
|
||||
__u32 iova_length; /* bytes mapped */
|
||||
};
|
||||
|
||||
#define sg_virt_addr(sg) ((unsigned long)(page_address(sg->page) + sg->offset))
|
||||
#define sg_virt_addr(sg) ((unsigned long)sg_virt(sg))
|
||||
#define sg_dma_address(sg) ((sg)->iova)
|
||||
#define sg_dma_len(sg) ((sg)->iova_length)
|
||||
|
||||
|
@ -285,9 +285,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
|
||||
BUG_ON(direction == DMA_NONE);
|
||||
|
||||
for_each_sg(sgl, sg, nents, i) {
|
||||
BUG_ON(!sg->page);
|
||||
__dma_sync_page(sg->page, sg->offset, sg->length, direction);
|
||||
sg->dma_address = page_to_bus(sg->page) + sg->offset;
|
||||
BUG_ON(!sg_page(sg));
|
||||
__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
|
||||
sg->dma_address = page_to_bus(sg_page(sg)) + sg->offset;
|
||||
}
|
||||
|
||||
return nents;
|
||||
@ -328,7 +328,7 @@ static inline void dma_sync_sg_for_cpu(struct device *dev,
|
||||
BUG_ON(direction == DMA_NONE);
|
||||
|
||||
for_each_sg(sgl, sg, nents, i)
|
||||
__dma_sync_page(sg->page, sg->offset, sg->length, direction);
|
||||
__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
|
||||
}
|
||||
|
||||
static inline void dma_sync_sg_for_device(struct device *dev,
|
||||
@ -341,7 +341,7 @@ static inline void dma_sync_sg_for_device(struct device *dev,
|
||||
BUG_ON(direction == DMA_NONE);
|
||||
|
||||
for_each_sg(sgl, sg, nents, i)
|
||||
__dma_sync_page(sg->page, sg->offset, sg->length, direction);
|
||||
__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
|
||||
}
|
||||
|
||||
static inline int dma_mapping_error(dma_addr_t dma_addr)
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __ASM_SH_DMA_MAPPING_H
|
||||
|
||||
#include <linux/mm.h>
|
||||
#include <asm/scatterlist.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
@ -85,10 +85,9 @@ static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
|
||||
|
||||
for (i = 0; i < nents; i++) {
|
||||
#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
|
||||
dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
|
||||
sg[i].length, dir);
|
||||
dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
|
||||
#endif
|
||||
sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
|
||||
sg[i].dma_address = sg_phys(&sg[i]);
|
||||
}
|
||||
|
||||
return nents;
|
||||
@ -138,10 +137,9 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
|
||||
|
||||
for (i = 0; i < nelems; i++) {
|
||||
#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
|
||||
dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
|
||||
sg[i].length, dir);
|
||||
dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
|
||||
#endif
|
||||
sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
|
||||
sg[i].dma_address = sg_phys(&sg[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __ASM_SH_DMA_MAPPING_H
|
||||
|
||||
#include <linux/mm.h>
|
||||
#include <asm/scatterlist.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
struct pci_dev;
|
||||
@ -71,10 +71,9 @@ static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
|
||||
|
||||
for (i = 0; i < nents; i++) {
|
||||
#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
|
||||
dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
|
||||
sg[i].length, dir);
|
||||
dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
|
||||
#endif
|
||||
sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
|
||||
sg[i].dma_address = sg_phys(&sg[i]);
|
||||
}
|
||||
|
||||
return nents;
|
||||
@ -124,10 +123,9 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
|
||||
|
||||
for (i = 0; i < nelems; i++) {
|
||||
#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
|
||||
dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
|
||||
sg[i].length, dir);
|
||||
dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
|
||||
#endif
|
||||
sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
|
||||
sg[i].dma_address = sg_phys(&sg[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/inet.h>
|
||||
#include <asm/scatterlist.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <net/sock.h>
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/pfkeyv2.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <net/xfrm.h>
|
||||
#if defined(CONFIG_INET_AH) || defined(CONFIG_INET_AH_MODULE) || defined(CONFIG_INET6_AH) || defined(CONFIG_INET6_AH_MODULE)
|
||||
#include <net/ah.h>
|
||||
|
Loading…
Reference in New Issue
Block a user