aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/iommu.c2
-rw-r--r--arch/sparc64/kernel/iommu_common.c8
-rw-r--r--arch/sparc64/kernel/iommu_common.h3
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c8
-rw-r--r--arch/sparc64/kernel/systbls.S4
5 files changed, 15 insertions, 10 deletions
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c
index 070a4846c0cb..4b9115a4d92e 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc64/kernel/iommu.c
@@ -580,7 +580,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
580 580
581 /* Step 1: Prepare scatter list. */ 581 /* Step 1: Prepare scatter list. */
582 582
583 npages = prepare_sg(sglist, nelems); 583 npages = prepare_sg(dev, sglist, nelems);
584 584
585 /* Step 2: Allocate a cluster and context, if necessary. */ 585 /* Step 2: Allocate a cluster and context, if necessary. */
586 586
diff --git a/arch/sparc64/kernel/iommu_common.c b/arch/sparc64/kernel/iommu_common.c
index efd5dff85f60..72a4acfe8c7b 100644
--- a/arch/sparc64/kernel/iommu_common.c
+++ b/arch/sparc64/kernel/iommu_common.c
@@ -4,6 +4,7 @@
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
5 */ 5 */
6 6
7#include <linux/dma-mapping.h>
7#include "iommu_common.h" 8#include "iommu_common.h"
8 9
9/* You are _strongly_ advised to enable the following debugging code 10/* You are _strongly_ advised to enable the following debugging code
@@ -201,21 +202,24 @@ void verify_sglist(struct scatterlist *sglist, int nents, iopte_t *iopte, int np
201} 202}
202#endif 203#endif
203 204
204unsigned long prepare_sg(struct scatterlist *sg, int nents) 205unsigned long prepare_sg(struct device *dev, struct scatterlist *sg, int nents)
205{ 206{
206 struct scatterlist *dma_sg = sg; 207 struct scatterlist *dma_sg = sg;
207 unsigned long prev; 208 unsigned long prev;
208 u32 dent_addr, dent_len; 209 u32 dent_addr, dent_len;
210 unsigned int max_seg_size;
209 211
210 prev = (unsigned long) sg_virt(sg); 212 prev = (unsigned long) sg_virt(sg);
211 prev += (unsigned long) (dent_len = sg->length); 213 prev += (unsigned long) (dent_len = sg->length);
212 dent_addr = (u32) ((unsigned long)(sg_virt(sg)) & (IO_PAGE_SIZE - 1UL)); 214 dent_addr = (u32) ((unsigned long)(sg_virt(sg)) & (IO_PAGE_SIZE - 1UL));
215 max_seg_size = dma_get_max_seg_size(dev);
213 while (--nents) { 216 while (--nents) {
214 unsigned long addr; 217 unsigned long addr;
215 218
216 sg = sg_next(sg); 219 sg = sg_next(sg);
217 addr = (unsigned long) sg_virt(sg); 220 addr = (unsigned long) sg_virt(sg);
218 if (! VCONTIG(prev, addr)) { 221 if (! VCONTIG(prev, addr) ||
222 dent_len + sg->length > max_seg_size) {
219 dma_sg->dma_address = dent_addr; 223 dma_sg->dma_address = dent_addr;
220 dma_sg->dma_length = dent_len; 224 dma_sg->dma_length = dent_len;
221 dma_sg = sg_next(dma_sg); 225 dma_sg = sg_next(dma_sg);
diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc64/kernel/iommu_common.h
index 75b5a5814522..a90d046e8024 100644
--- a/arch/sparc64/kernel/iommu_common.h
+++ b/arch/sparc64/kernel/iommu_common.h
@@ -9,6 +9,7 @@
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/scatterlist.h> 11#include <linux/scatterlist.h>
12#include <linux/device.h>
12 13
13#include <asm/iommu.h> 14#include <asm/iommu.h>
14#include <asm/scatterlist.h> 15#include <asm/scatterlist.h>
@@ -46,4 +47,4 @@ extern void verify_sglist(struct scatterlist *sg, int nents, iopte_t *iopte, int
46#define VCONTIG(__X, __Y) (((__X) == (__Y)) || \ 47#define VCONTIG(__X, __Y) (((__X) == (__Y)) || \
47 (((__X) | (__Y)) << (64UL - PAGE_SHIFT)) == 0UL) 48 (((__X) | (__Y)) << (64UL - PAGE_SHIFT)) == 0UL)
48 49
49extern unsigned long prepare_sg(struct scatterlist *sg, int nents); 50extern unsigned long prepare_sg(struct device *dev, struct scatterlist *sg, int nents);
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 1aa8e044b105..5ea2eab1ccda 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -490,7 +490,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
490 goto bad; 490 goto bad;
491 491
492 /* Step 1: Prepare scatter list. */ 492 /* Step 1: Prepare scatter list. */
493 npages = prepare_sg(sglist, nelems); 493 npages = prepare_sg(dev, sglist, nelems);
494 494
495 /* Step 2: Allocate a cluster and context, if necessary. */ 495 /* Step 2: Allocate a cluster and context, if necessary. */
496 spin_lock_irqsave(&iommu->lock, flags); 496 spin_lock_irqsave(&iommu->lock, flags);
@@ -625,8 +625,8 @@ static void __init pci_sun4v_scan_bus(struct pci_pbm_info *pbm)
625 /* XXX register error interrupt handlers XXX */ 625 /* XXX register error interrupt handlers XXX */
626} 626}
627 627
628static unsigned long probe_existing_entries(struct pci_pbm_info *pbm, 628static unsigned long __init probe_existing_entries(struct pci_pbm_info *pbm,
629 struct iommu *iommu) 629 struct iommu *iommu)
630{ 630{
631 struct iommu_arena *arena = &iommu->arena; 631 struct iommu_arena *arena = &iommu->arena;
632 unsigned long i, cnt = 0; 632 unsigned long i, cnt = 0;
@@ -653,7 +653,7 @@ static unsigned long probe_existing_entries(struct pci_pbm_info *pbm,
653 return cnt; 653 return cnt;
654} 654}
655 655
656static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) 656static void __init pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
657{ 657{
658 struct iommu *iommu = pbm->iommu; 658 struct iommu *iommu = pbm->iommu;
659 struct property *prop; 659 struct property *prop;
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 06d10907d8ce..b8058906e727 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -80,7 +80,7 @@ sys_call_table32:
80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare 80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
81/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages, compat_sys_mbind, compat_sys_get_mempolicy 81/*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages, compat_sys_mbind, compat_sys_get_mempolicy
82 .word compat_sys_set_mempolicy, compat_sys_kexec_load, compat_sys_move_pages, sys_getcpu, compat_sys_epoll_pwait 82 .word compat_sys_set_mempolicy, compat_sys_kexec_load, compat_sys_move_pages, sys_getcpu, compat_sys_epoll_pwait
83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, compat_sys_timerfd, sys_eventfd, compat_sys_fallocate 83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_ni_syscall, sys_eventfd, compat_sys_fallocate
84 84
85#endif /* CONFIG_COMPAT */ 85#endif /* CONFIG_COMPAT */
86 86
@@ -152,7 +152,7 @@ sys_call_table:
152 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 152 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
153/*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy 153/*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy
154 .word sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait 154 .word sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait
155/*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd, sys_eventfd, sys_fallocate 155/*310*/ .word sys_utimensat, sys_signalfd, sys_ni_syscall, sys_eventfd, sys_fallocate
156 156
157#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ 157#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
158 defined(CONFIG_SOLARIS_EMUL_MODULE) 158 defined(CONFIG_SOLARIS_EMUL_MODULE)