From 9f2326be52f4fa83d20a75998cd3c87b300588c4 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 23 Oct 2007 09:11:41 +0200 Subject: arm: build fix arch/arm/common/dmabounce.c: In function 'dma_map_sg': arch/arm/common/dmabounce.c:445: error: implicit declaration of function 'sg_page' Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- arch/arm/common/dmabounce.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 9d371e47655..52fc6a88328 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c @@ -29,6 +29,7 @@ #include #include #include +#include #include -- cgit v1.2.3-18-g5258 From c8ac5a7309c5060e27caf69403072f54e008ee54 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Tue, 23 Oct 2007 09:12:52 +0200 Subject: IB/ehca: Fix sg_page() fallout More fallout from sg_page changes: drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 'ehca_set_pagebuf_user1': drivers/infiniband/hw/ehca/ehca_mrmw.c:1779: error: 'struct scatterlist' has no member named 'page' drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 'ehca_check_kpages_per_ate': drivers/infiniband/hw/ehca/ehca_mrmw.c:1835: error: 'struct scatterlist' has no member named 'page' drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 'ehca_set_pagebuf_user2': drivers/infiniband/hw/ehca/ehca_mrmw.c:1870: error: 'struct scatterlist' has no member named 'page' Signed-off-by: Olof Johansson Signed-off-by: Jens Axboe --- drivers/infiniband/hw/ehca/ehca_mrmw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c index da88738265e..ead7230d773 100644 --- a/drivers/infiniband/hw/ehca/ehca_mrmw.c +++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c @@ -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) ) { -- cgit v1.2.3-18-g5258 From 5edadbd0ae35d2daabaf6b44f2c58d67d4021ed2 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Tue, 23 Oct 2007 09:13:14 +0200 Subject: powerpc: Fix fallout from sg_page() changes Fix fallout from 18dabf473e15850c0dbc8ff13ac1e2806d542c15: In file included from include/linux/dma-mapping.h:52, from drivers/base/dma-mapping.c:10: include/asm/dma-mapping.h: In function 'dma_map_sg': include/asm/dma-mapping.h:288: error: 'struct scatterlist' has no member named 'page' include/asm/dma-mapping.h:288: error: 'struct scatterlist' has no member named 'page' include/asm/dma-mapping.h:288: error: 'struct scatterlist' has no member named 'page' include/asm/dma-mapping.h:289: error: 'struct scatterlist' has no member named 'page' include/asm/dma-mapping.h:290: error: 'struct scatterlist' has no member named 'page' include/asm/dma-mapping.h: In function 'dma_sync_sg_for_cpu': include/asm/dma-mapping.h:331: error: 'struct scatterlist' has no member named 'page' drivers/scsi/ps3rom.c: In function 'fetch_to_dev_buffer': drivers/scsi/ps3rom.c:150: error: 'struct scatterlist' has no member named 'page' Signed-off-by: Olof Johansson Signed-off-by: Jens Axboe --- drivers/scsi/ps3rom.c | 2 +- include/asm-powerpc/dma-mapping.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index 03f19b8d19c..17b4a7c4618 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c @@ -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; diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h index 65be95dd03a..ff52013c0e2 100644 --- a/include/asm-powerpc/dma-mapping.h +++ b/include/asm-powerpc/dma-mapping.h @@ -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) -- cgit v1.2.3-18-g5258 From 73fc4f0d2ce4a92c36b00649c58e0a068a6cdfa4 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 09:17:53 +0200 Subject: s390 zfcp: sg fixups Based on initial patch from Heiko Carstens Signed-off-by: Jens Axboe --- drivers/s390/scsi/zfcp_aux.c | 1 + drivers/s390/scsi/zfcp_def.h | 4 ++-- drivers/s390/scsi/zfcp_erp.c | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 7507067351b..fd5d0c1570d 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c @@ -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); diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 57cac7008e0..326e7ee232c 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h @@ -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); } diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index a6475a2bb8a..9438d0b2879 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -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); -- cgit v1.2.3-18-g5258 From ad0d4083e65d9f223275adbfb9a7927e2120dc6c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 09:27:05 +0200 Subject: [BLOCK] Don't clear sg_dma_len/addr() in blk_rq_map_sg() It's not a proper lvalue on all archs. Signed-off-by: Jens Axboe --- block/ll_rw_blk.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index 61c2e396f2f..fb8fb8852c3 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c @@ -1354,8 +1354,6 @@ new_segment: else 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; -- cgit v1.2.3-18-g5258 From 7aeacf982203fb4dea2f3434eefdc268cfd5d6d9 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 09:49:25 +0200 Subject: [BLOCK] blk_rq_map_sg: force clear termination bit Since blk_rq_map_sg() sets the termination bit at the end of the sg table, we could see it prematurely on the next mapping unless we force drivers to do a full sg_init_table() prior to each mapping. So force clear the termination bit to avoid having to put that clear in the driver for every mapping. Signed-off-by: Jens Axboe --- block/ll_rw_blk.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index fb8fb8852c3..de5ba479c22 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c @@ -1351,8 +1351,20 @@ 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_set_page(sg, bvec->bv_page); sg->length = nbytes; -- cgit v1.2.3-18-g5258 From b3b724f48c0c0ade1d5120744cc5c9a3e5193d08 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Tue, 23 Oct 2007 09:28:34 +0200 Subject: net: fix xfrm build - missing scatterlist.h include net/xfrm/xfrm_algo.c: In function 'skb_icv_walk': net/xfrm/xfrm_algo.c:555: error: implicit declaration of function 'sg_set_page' make[2]: *** [net/xfrm/xfrm_algo.o] Error 1 Cc: David Miller Signed-off-by: Heiko Carstens Signed-off-by: Jens Axboe --- net/xfrm/xfrm_algo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c index fb2220a719b..313d4bed3aa 100644 --- a/net/xfrm/xfrm_algo.c +++ b/net/xfrm/xfrm_algo.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #if defined(CONFIG_INET_AH) || defined(CONFIG_INET_AH_MODULE) || defined(CONFIG_INET6_AH) || defined(CONFIG_INET6_AH_MODULE) #include -- cgit v1.2.3-18-g5258 From dc81785dd620c770cf929ff25bb4720e91c23f7a Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 23 Oct 2007 09:29:58 +0200 Subject: ide: build fix git-drivers/ide/ide-probe.c: In function 'hwif_init': drivers/ide/ide-probe.c:1327: error: implicit declaration of function 'sg_init_table' Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- drivers/ide/ide-probe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index ec55a173c08..6a6f2e066b4 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3-18-g5258 From b61e8f4844fd0767b656bd1f983933cc3d0102f3 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 23 Oct 2007 09:30:28 +0200 Subject: parisc: fix sg_page() fallout arch/parisc/kernel/pci-dma.c: In function 'pa11_dma_map_sg': arch/parisc/kernel/pci-dma.c:487: error: 'struct scatterlist' has no member named 'page' arch/parisc/kernel/pci-dma.c: In function 'pa11_dma_unmap_sg': arch/parisc/kernel/pci-dma.c:508: error: 'struct scatterlist' has no member named 'page' arch/parisc/kernel/pci-dma.c:508: error: 'struct scatterlist' has no member named 'page' arch/parisc/kernel/pci-dma.c: In function 'pa11_dma_sync_sg_for_cpu': arch/parisc/kernel/pci-dma.c:535: error: 'struct scatterlist' has no member named 'page' arch/parisc/kernel/pci-dma.c:535: error: 'struct scatterlist' has no member named 'page' arch/parisc/kernel/pci-dma.c: In function 'pa11_dma_sync_sg_for_device': arch/parisc/kernel/pci-dma.c:545: error: 'struct scatterlist' has no member named 'page' arch/parisc/kernel/pci-dma.c:545: error: 'struct scatterlist' has no member named 'page' Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- arch/parisc/kernel/pci-dma.c | 1 + drivers/parisc/ccio-dma.c | 1 + drivers/parisc/sba_iommu.c | 1 + include/asm-parisc/scatterlist.h | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c index 41f8e321e34..9448d4e9114 100644 --- a/arch/parisc/kernel/pci-dma.c +++ b/arch/parisc/kernel/pci-dma.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include /* for DMA_CHUNK_SIZE */ diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index b3c4dbff26b..7c60cbd85dc 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include /* for L1_CACHE_BYTES */ diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index e5c323936ea..e527a0e1d6c 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/include/asm-parisc/scatterlist.h b/include/asm-parisc/scatterlist.h index cd3cfdf8228..62269b31ebf 100644 --- a/include/asm-parisc/scatterlist.h +++ b/include/asm-parisc/scatterlist.h @@ -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) -- cgit v1.2.3-18-g5258 From 12d4d40e6fd583d32daeac0bc42123b23b7c40b7 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 23 Oct 2007 09:32:25 +0200 Subject: intel-iommu: fix sg_page() Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- drivers/pci/intel-iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index b3d70310af4..0c4ab3b0727 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c @@ -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; } -- cgit v1.2.3-18-g5258 From 944bda26fbfb3c30533b95ee4aaff72778008f78 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 12:31:05 +0200 Subject: alpha: sg_virt() fallout Signed-off-by: Jens Axboe --- arch/alpha/kernel/pci_iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index ee07dceae1d..2d00a08d3f0 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3-18-g5258 From 4fcc47a053adc786cc1ab84f3b8909eeb5c37963 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 12:32:34 +0200 Subject: mips: sg_page() fallout Signed-off-by: Jens Axboe --- arch/mips/mm/dma-default.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index b0b034c4654..b1b40527658 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3-18-g5258 From dee9ba828fb5e72bef17450168774fb360dce983 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 12:37:59 +0200 Subject: arm: sg fallout Signed-off-by: Jens Axboe --- include/asm-arm/dma-mapping.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h index 1eb8aac4322..e99406a7bec 100644 --- a/include/asm-arm/dma-mapping.h +++ b/include/asm-arm/dma-mapping.h @@ -5,7 +5,7 @@ #include /* need struct page */ -#include +#include /* * 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); } -- cgit v1.2.3-18-g5258 From 26da10784866974d3e87ba998c66458c305777ca Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 12:42:44 +0200 Subject: blackfin: remove sg_address() I would have replaced it with sg_virt(), but it doesn't appear to be used at all. Signed-off-by: Jens Axboe --- include/asm-blackfin/scatterlist.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/asm-blackfin/scatterlist.h b/include/asm-blackfin/scatterlist.h index 32128d53469..04f448711cd 100644 --- a/include/asm-blackfin/scatterlist.h +++ b/include/asm-blackfin/scatterlist.h @@ -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) -- cgit v1.2.3-18-g5258 From d09d276ebf62afdaed5f7bab6e7e340ffbde4dd1 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 12:39:41 +0200 Subject: frv: update comment in scatterlist to reflect new setup Signed-off-by: Jens Axboe --- include/asm-frv/scatterlist.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h index f7da007b763..99ba76edc42 100644 --- a/include/asm-frv/scatterlist.h +++ b/include/asm-frv/scatterlist.h @@ -4,19 +4,19 @@ #include /* - * 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 -- cgit v1.2.3-18-g5258 From 75d35c93cf8b938f28f06ceb8ffa2606d6e57d3b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 12:41:57 +0200 Subject: m68knommu: remove sg_address() I would have replaced it with sg_virt(), but it doesn't appear to be used at all. Signed-off-by: Jens Axboe --- include/asm-m68knommu/scatterlist.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/asm-m68knommu/scatterlist.h b/include/asm-m68knommu/scatterlist.h index 10942840e88..afc4788b0d2 100644 --- a/include/asm-m68knommu/scatterlist.h +++ b/include/asm-m68knommu/scatterlist.h @@ -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) -- cgit v1.2.3-18-g5258 From ebc3bbcfcf0a7fed2ac82f1a849a5f92cf4c217f Mon Sep 17 00:00:00 2001 From: Christian Borntraeger Date: Tue, 23 Oct 2007 12:46:32 +0200 Subject: Fix sctp compile sctp fails to compile with net/sctp/sm_make_chunk.c: In function 'sctp_pack_cookie': net/sctp/sm_make_chunk.c:1516: error: implicit declaration of function 'sg_init_table' net/sctp/sm_make_chunk.c:1517: error: implicit declaration of function 'sg_set_page' use the proper include file. SCTP maintainers Vlad Yasevich and Sridhar Samudrala are CCed. Signed-off-by: Christian Borntraeger Signed-off-by: Jens Axboe --- net/sctp/sm_make_chunk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index d5a9785a158..658476c4d58 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include -- cgit v1.2.3-18-g5258 From 71df50a4e4ca9934bbf520c87612d711278f38af Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 12:52:48 +0200 Subject: sh/sh64: fixup dma-mapping for new sg layout Signed-off-by: Jens Axboe --- include/asm-sh/dma-mapping.h | 12 +++++------- include/asm-sh64/dma-mapping.h | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h index 84fefdaa01a..fcea067f7a9 100644 --- a/include/asm-sh/dma-mapping.h +++ b/include/asm-sh/dma-mapping.h @@ -2,7 +2,7 @@ #define __ASM_SH_DMA_MAPPING_H #include -#include +#include #include #include @@ -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]); } } diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h index e661857f98d..1438b763a5e 100644 --- a/include/asm-sh64/dma-mapping.h +++ b/include/asm-sh64/dma-mapping.h @@ -2,7 +2,7 @@ #define __ASM_SH_DMA_MAPPING_H #include -#include +#include #include 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]); } } -- cgit v1.2.3-18-g5258 From 83fcaf70403ce04c693b52e62c794834b9a86089 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 23 Oct 2007 12:54:14 +0200 Subject: fvr32: fixup dma-mapping for new sg layout Signed-off-by: Jens Axboe --- include/asm-avr32/dma-mapping.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h index 81e342636ac..a7131630c05 100644 --- a/include/asm-avr32/dma-mapping.h +++ b/include/asm-avr32/dma-mapping.h @@ -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); } } -- cgit v1.2.3-18-g5258 From cb92ae81509eb5ddaea53884b60437502c837405 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 23 Oct 2007 12:58:39 +0200 Subject: sparc64: zero out dma_length zero out dma_length in the entry immediately following the last mapped entry for unmap_sg. Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- arch/sparc64/kernel/iommu_common.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/sparc64/kernel/iommu_common.c b/arch/sparc64/kernel/iommu_common.c index 78e8277df65..b70324e0d83 100644 --- a/arch/sparc64/kernel/iommu_common.c +++ b/arch/sparc64/kernel/iommu_common.c @@ -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; -- cgit v1.2.3-18-g5258