blob: 7c55450b55b9bb48d67373ca33a553fa4fd8a25a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * iommu.c: IOMMU specific routines for memory management.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1995,2002 Pete Zaitcev (zaitcev@yahoo.com)
6 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
7 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
8 */
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/mm.h>
13#include <linux/slab.h>
14#include <linux/highmem.h> /* pte_offset_map => kmap_atomic */
Jens Axboe0912a5d2007-05-14 15:44:38 +020015#include <linux/scatterlist.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <asm/pgalloc.h>
18#include <asm/pgtable.h>
19#include <asm/sbus.h>
20#include <asm/io.h>
21#include <asm/mxcc.h>
22#include <asm/mbus.h>
23#include <asm/cacheflush.h>
24#include <asm/tlbflush.h>
25#include <asm/bitext.h>
26#include <asm/iommu.h>
27#include <asm/dma.h>
28
29/*
30 * This can be sized dynamically, but we will do this
31 * only when we have a guidance about actual I/O pressures.
32 */
33#define IOMMU_RNGE IOMMU_RNGE_256MB
34#define IOMMU_START 0xF0000000
35#define IOMMU_WINSIZE (256*1024*1024U)
36#define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 265KB */
37#define IOMMU_ORDER 6 /* 4096 * (1<<6) */
38
39/* srmmu.c */
40extern int viking_mxcc_present;
41BTFIXUPDEF_CALL(void, flush_page_for_dma, unsigned long)
42#define flush_page_for_dma(page) BTFIXUP_CALL(flush_page_for_dma)(page)
43extern int flush_page_for_dma_global;
44static int viking_flush;
45/* viking.S */
46extern void viking_flush_page(unsigned long page);
47extern void viking_mxcc_flush_page(unsigned long page);
48
49/*
50 * Values precomputed according to CPU type.
51 */
52static unsigned int ioperm_noc; /* Consistent mapping iopte flags */
53static pgprot_t dvma_prot; /* Consistent mapping pte flags */
54
55#define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID)
56#define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ)
57
David S. Miller046e26a2008-08-27 04:54:04 -070058static void __init sbus_iommu_init(struct of_device *op)
Linus Torvalds1da177e2005-04-16 15:20:36 -070059{
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 struct iommu_struct *iommu;
David S. Millere0039342008-08-25 22:47:20 -070061 unsigned int impl, vers;
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 unsigned long *bitmap;
David S. Millere0039342008-08-25 22:47:20 -070063 unsigned long tmp;
64
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 iommu = kmalloc(sizeof(struct iommu_struct), GFP_ATOMIC);
66 if (!iommu) {
67 prom_printf("Unable to allocate iommu structure\n");
68 prom_halt();
69 }
David S. Millere0039342008-08-25 22:47:20 -070070
David S. Miller046e26a2008-08-27 04:54:04 -070071 iommu->regs = of_ioremap(&op->resource[0], 0, PAGE_SIZE * 3,
David S. Millere0039342008-08-25 22:47:20 -070072 "iommu_regs");
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 if (!iommu->regs) {
74 prom_printf("Cannot map IOMMU registers\n");
75 prom_halt();
76 }
77 impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28;
78 vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24;
79 tmp = iommu->regs->control;
80 tmp &= ~(IOMMU_CTRL_RNGE);
81 tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB);
82 iommu->regs->control = tmp;
83 iommu_invalidate(iommu->regs);
84 iommu->start = IOMMU_START;
85 iommu->end = 0xffffffff;
86
87 /* Allocate IOMMU page table */
88 /* Stupid alignment constraints give me a headache.
89 We need 256K or 512K or 1M or 2M area aligned to
90 its size and current gfp will fortunately give
91 it to us. */
92 tmp = __get_free_pages(GFP_KERNEL, IOMMU_ORDER);
93 if (!tmp) {
94 prom_printf("Unable to allocate iommu table [0x%08x]\n",
95 IOMMU_NPTES*sizeof(iopte_t));
96 prom_halt();
97 }
98 iommu->page_table = (iopte_t *)tmp;
99
100 /* Initialize new table. */
101 memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t));
102 flush_cache_all();
103 flush_tlb_all();
104 iommu->regs->base = __pa((unsigned long) iommu->page_table) >> 4;
105 iommu_invalidate(iommu->regs);
106
107 bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL);
108 if (!bitmap) {
109 prom_printf("Unable to allocate iommu bitmap [%d]\n",
110 (int)(IOMMU_NPTES>>3));
111 prom_halt();
112 }
113 bit_map_init(&iommu->usemap, bitmap, IOMMU_NPTES);
114 /* To be coherent on HyperSparc, the page color of DVMA
115 * and physical addresses must match.
116 */
117 if (srmmu_modtype == HyperSparc)
118 iommu->usemap.num_colors = vac_cache_size >> PAGE_SHIFT;
119 else
120 iommu->usemap.num_colors = 1;
121
David S. Miller046e26a2008-08-27 04:54:04 -0700122 printk(KERN_INFO "IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n",
123 impl, vers, iommu->page_table,
124 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125
David S. Millere0039342008-08-25 22:47:20 -0700126 op->dev.archdata.iommu = iommu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127}
128
David S. Miller046e26a2008-08-27 04:54:04 -0700129static int __init iommu_init(void)
130{
131 struct device_node *dp;
132
133 for_each_node_by_name(dp, "iommu") {
134 struct of_device *op = of_find_device_by_node(dp);
135
136 sbus_iommu_init(op);
137 of_propagate_archdata(op);
138 }
139
140 return 0;
141}
142
143subsys_initcall(iommu_init);
144
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145/* This begs to be btfixup-ed by srmmu. */
146/* Flush the iotlb entries to ram. */
147/* This could be better if we didn't have to flush whole pages. */
148static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte)
149{
150 unsigned long start;
151 unsigned long end;
152
Bob Breuer3185d4d2006-06-20 00:36:56 -0700153 start = (unsigned long)iopte;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 end = PAGE_ALIGN(start + niopte*sizeof(iopte_t));
Bob Breuer3185d4d2006-06-20 00:36:56 -0700155 start &= PAGE_MASK;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 if (viking_mxcc_present) {
157 while(start < end) {
158 viking_mxcc_flush_page(start);
159 start += PAGE_SIZE;
160 }
161 } else if (viking_flush) {
162 while(start < end) {
163 viking_flush_page(start);
164 start += PAGE_SIZE;
165 }
166 } else {
167 while(start < end) {
168 __flush_page_to_ram(start);
169 start += PAGE_SIZE;
170 }
171 }
172}
173
David S. Miller260489f2008-08-26 23:00:58 -0700174static u32 iommu_get_one(struct device *dev, struct page *page, int npages)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175{
David S. Miller260489f2008-08-26 23:00:58 -0700176 struct iommu_struct *iommu = dev->archdata.iommu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 int ioptex;
178 iopte_t *iopte, *iopte0;
179 unsigned int busa, busa0;
180 int i;
181
182 /* page color = pfn of page */
183 ioptex = bit_map_string_get(&iommu->usemap, npages, page_to_pfn(page));
184 if (ioptex < 0)
185 panic("iommu out");
186 busa0 = iommu->start + (ioptex << PAGE_SHIFT);
187 iopte0 = &iommu->page_table[ioptex];
188
189 busa = busa0;
190 iopte = iopte0;
191 for (i = 0; i < npages; i++) {
192 iopte_val(*iopte) = MKIOPTE(page_to_pfn(page), IOPERM);
193 iommu_invalidate_page(iommu->regs, busa);
194 busa += PAGE_SIZE;
195 iopte++;
196 page++;
197 }
198
199 iommu_flush_iotlb(iopte0, npages);
200
201 return busa0;
202}
203
David S. Miller260489f2008-08-26 23:00:58 -0700204static u32 iommu_get_scsi_one(struct device *dev, char *vaddr, unsigned int len)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205{
206 unsigned long off;
207 int npages;
208 struct page *page;
209 u32 busa;
210
211 off = (unsigned long)vaddr & ~PAGE_MASK;
212 npages = (off + len + PAGE_SIZE-1) >> PAGE_SHIFT;
213 page = virt_to_page((unsigned long)vaddr & PAGE_MASK);
David S. Miller260489f2008-08-26 23:00:58 -0700214 busa = iommu_get_one(dev, page, npages);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215 return busa + off;
216}
217
David S. Miller260489f2008-08-26 23:00:58 -0700218static __u32 iommu_get_scsi_one_noflush(struct device *dev, char *vaddr, unsigned long len)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219{
David S. Miller260489f2008-08-26 23:00:58 -0700220 return iommu_get_scsi_one(dev, vaddr, len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221}
222
David S. Miller260489f2008-08-26 23:00:58 -0700223static __u32 iommu_get_scsi_one_gflush(struct device *dev, char *vaddr, unsigned long len)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224{
225 flush_page_for_dma(0);
David S. Miller260489f2008-08-26 23:00:58 -0700226 return iommu_get_scsi_one(dev, vaddr, len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227}
228
David S. Miller260489f2008-08-26 23:00:58 -0700229static __u32 iommu_get_scsi_one_pflush(struct device *dev, char *vaddr, unsigned long len)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230{
231 unsigned long page = ((unsigned long) vaddr) & PAGE_MASK;
232
233 while(page < ((unsigned long)(vaddr + len))) {
234 flush_page_for_dma(page);
235 page += PAGE_SIZE;
236 }
David S. Miller260489f2008-08-26 23:00:58 -0700237 return iommu_get_scsi_one(dev, vaddr, len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238}
239
David S. Miller260489f2008-08-26 23:00:58 -0700240static void iommu_get_scsi_sgl_noflush(struct device *dev, struct scatterlist *sg, int sz)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241{
242 int n;
243
244 while (sz != 0) {
245 --sz;
246 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
David S. Miller260489f2008-08-26 23:00:58 -0700247 sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248 sg->dvma_length = (__u32) sg->length;
Jens Axboe0912a5d2007-05-14 15:44:38 +0200249 sg = sg_next(sg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 }
251}
252
David S. Miller260489f2008-08-26 23:00:58 -0700253static void iommu_get_scsi_sgl_gflush(struct device *dev, struct scatterlist *sg, int sz)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254{
255 int n;
256
257 flush_page_for_dma(0);
258 while (sz != 0) {
259 --sz;
260 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
David S. Miller260489f2008-08-26 23:00:58 -0700261 sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 sg->dvma_length = (__u32) sg->length;
Jens Axboe0912a5d2007-05-14 15:44:38 +0200263 sg = sg_next(sg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 }
265}
266
David S. Miller260489f2008-08-26 23:00:58 -0700267static void iommu_get_scsi_sgl_pflush(struct device *dev, struct scatterlist *sg, int sz)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268{
269 unsigned long page, oldpage = 0;
270 int n, i;
271
272 while(sz != 0) {
273 --sz;
274
275 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
276
277 /*
278 * We expect unmapped highmem pages to be not in the cache.
279 * XXX Is this a good assumption?
280 * XXX What if someone else unmaps it here and races us?
281 */
Jens Axboe58b053e2007-10-22 20:02:46 +0200282 if ((page = (unsigned long) page_address(sg_page(sg))) != 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283 for (i = 0; i < n; i++) {
284 if (page != oldpage) { /* Already flushed? */
285 flush_page_for_dma(page);
286 oldpage = page;
287 }
288 page += PAGE_SIZE;
289 }
290 }
291
David S. Miller260489f2008-08-26 23:00:58 -0700292 sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293 sg->dvma_length = (__u32) sg->length;
Jens Axboe0912a5d2007-05-14 15:44:38 +0200294 sg = sg_next(sg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 }
296}
297
David S. Miller260489f2008-08-26 23:00:58 -0700298static void iommu_release_one(struct device *dev, u32 busa, int npages)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299{
David S. Miller260489f2008-08-26 23:00:58 -0700300 struct iommu_struct *iommu = dev->archdata.iommu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301 int ioptex;
302 int i;
303
Eric Sesterhenn1ae61382006-01-17 15:36:05 -0800304 BUG_ON(busa < iommu->start);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 ioptex = (busa - iommu->start) >> PAGE_SHIFT;
306 for (i = 0; i < npages; i++) {
307 iopte_val(iommu->page_table[ioptex + i]) = 0;
308 iommu_invalidate_page(iommu->regs, busa);
309 busa += PAGE_SIZE;
310 }
311 bit_map_clear(&iommu->usemap, ioptex, npages);
312}
313
David S. Miller260489f2008-08-26 23:00:58 -0700314static void iommu_release_scsi_one(struct device *dev, __u32 vaddr, unsigned long len)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315{
316 unsigned long off;
317 int npages;
318
319 off = vaddr & ~PAGE_MASK;
320 npages = (off + len + PAGE_SIZE-1) >> PAGE_SHIFT;
David S. Miller260489f2008-08-26 23:00:58 -0700321 iommu_release_one(dev, vaddr & PAGE_MASK, npages);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322}
323
David S. Miller260489f2008-08-26 23:00:58 -0700324static void iommu_release_scsi_sgl(struct device *dev, struct scatterlist *sg, int sz)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325{
326 int n;
327
328 while(sz != 0) {
329 --sz;
330
331 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
David S. Miller260489f2008-08-26 23:00:58 -0700332 iommu_release_one(dev, sg->dvma_address & PAGE_MASK, n);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333 sg->dvma_address = 0x21212121;
Jens Axboe0912a5d2007-05-14 15:44:38 +0200334 sg = sg_next(sg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 }
336}
337
338#ifdef CONFIG_SBUS
David S. Miller4b1c5df2008-08-27 18:40:38 -0700339static int iommu_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned long va,
340 unsigned long addr, int len)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341{
David S. Miller4b1c5df2008-08-27 18:40:38 -0700342 struct iommu_struct *iommu = dev->archdata.iommu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 unsigned long page, end;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 iopte_t *iopte = iommu->page_table;
345 iopte_t *first;
346 int ioptex;
347
Eric Sesterhenn1ae61382006-01-17 15:36:05 -0800348 BUG_ON((va & ~PAGE_MASK) != 0);
349 BUG_ON((addr & ~PAGE_MASK) != 0);
350 BUG_ON((len & ~PAGE_MASK) != 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351
352 /* page color = physical address */
353 ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT,
354 addr >> PAGE_SHIFT);
355 if (ioptex < 0)
356 panic("iommu out");
357
358 iopte += ioptex;
359 first = iopte;
360 end = addr + len;
361 while(addr < end) {
362 page = va;
363 {
364 pgd_t *pgdp;
365 pmd_t *pmdp;
366 pte_t *ptep;
367
368 if (viking_mxcc_present)
369 viking_mxcc_flush_page(page);
370 else if (viking_flush)
371 viking_flush_page(page);
372 else
373 __flush_page_to_ram(page);
374
375 pgdp = pgd_offset(&init_mm, addr);
376 pmdp = pmd_offset(pgdp, addr);
377 ptep = pte_offset_map(pmdp, addr);
378
379 set_pte(ptep, mk_pte(virt_to_page(page), dvma_prot));
380 }
381 iopte_val(*iopte++) =
382 MKIOPTE(page_to_pfn(virt_to_page(page)), ioperm_noc);
383 addr += PAGE_SIZE;
384 va += PAGE_SIZE;
385 }
386 /* P3: why do we need this?
387 *
388 * DAVEM: Because there are several aspects, none of which
389 * are handled by a single interface. Some cpus are
390 * completely not I/O DMA coherent, and some have
391 * virtually indexed caches. The driver DMA flushing
392 * methods handle the former case, but here during
393 * IOMMU page table modifications, and usage of non-cacheable
394 * cpu mappings of pages potentially in the cpu caches, we have
395 * to handle the latter case as well.
396 */
397 flush_cache_all();
398 iommu_flush_iotlb(first, len >> PAGE_SHIFT);
399 flush_tlb_all();
400 iommu_invalidate(iommu->regs);
401
402 *pba = iommu->start + (ioptex << PAGE_SHIFT);
403 return 0;
404}
405
David S. Miller4b1c5df2008-08-27 18:40:38 -0700406static void iommu_unmap_dma_area(struct device *dev, unsigned long busa, int len)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407{
David S. Miller4b1c5df2008-08-27 18:40:38 -0700408 struct iommu_struct *iommu = dev->archdata.iommu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 iopte_t *iopte = iommu->page_table;
410 unsigned long end;
411 int ioptex = (busa - iommu->start) >> PAGE_SHIFT;
412
Eric Sesterhenn1ae61382006-01-17 15:36:05 -0800413 BUG_ON((busa & ~PAGE_MASK) != 0);
414 BUG_ON((len & ~PAGE_MASK) != 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415
416 iopte += ioptex;
417 end = busa + len;
418 while (busa < end) {
419 iopte_val(*iopte++) = 0;
420 busa += PAGE_SIZE;
421 }
422 flush_tlb_all();
423 iommu_invalidate(iommu->regs);
424 bit_map_clear(&iommu->usemap, ioptex, len >> PAGE_SHIFT);
425}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426#endif
427
428static char *iommu_lockarea(char *vaddr, unsigned long len)
429{
430 return vaddr;
431}
432
433static void iommu_unlockarea(char *vaddr, unsigned long len)
434{
435}
436
437void __init ld_mmu_iommu(void)
438{
439 viking_flush = (BTFIXUPVAL_CALL(flush_page_for_dma) == (unsigned long)viking_flush_page);
440 BTFIXUPSET_CALL(mmu_lockarea, iommu_lockarea, BTFIXUPCALL_RETO0);
441 BTFIXUPSET_CALL(mmu_unlockarea, iommu_unlockarea, BTFIXUPCALL_NOP);
442
443 if (!BTFIXUPVAL_CALL(flush_page_for_dma)) {
444 /* IO coherent chip */
445 BTFIXUPSET_CALL(mmu_get_scsi_one, iommu_get_scsi_one_noflush, BTFIXUPCALL_RETO0);
446 BTFIXUPSET_CALL(mmu_get_scsi_sgl, iommu_get_scsi_sgl_noflush, BTFIXUPCALL_NORM);
447 } else if (flush_page_for_dma_global) {
448 /* flush_page_for_dma flushes everything, no matter of what page is it */
449 BTFIXUPSET_CALL(mmu_get_scsi_one, iommu_get_scsi_one_gflush, BTFIXUPCALL_NORM);
450 BTFIXUPSET_CALL(mmu_get_scsi_sgl, iommu_get_scsi_sgl_gflush, BTFIXUPCALL_NORM);
451 } else {
452 BTFIXUPSET_CALL(mmu_get_scsi_one, iommu_get_scsi_one_pflush, BTFIXUPCALL_NORM);
453 BTFIXUPSET_CALL(mmu_get_scsi_sgl, iommu_get_scsi_sgl_pflush, BTFIXUPCALL_NORM);
454 }
455 BTFIXUPSET_CALL(mmu_release_scsi_one, iommu_release_scsi_one, BTFIXUPCALL_NORM);
456 BTFIXUPSET_CALL(mmu_release_scsi_sgl, iommu_release_scsi_sgl, BTFIXUPCALL_NORM);
457
458#ifdef CONFIG_SBUS
459 BTFIXUPSET_CALL(mmu_map_dma_area, iommu_map_dma_area, BTFIXUPCALL_NORM);
460 BTFIXUPSET_CALL(mmu_unmap_dma_area, iommu_unmap_dma_area, BTFIXUPCALL_NORM);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461#endif
462
463 if (viking_mxcc_present || srmmu_modtype == HyperSparc) {
464 dvma_prot = __pgprot(SRMMU_CACHE | SRMMU_ET_PTE | SRMMU_PRIV);
465 ioperm_noc = IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID;
466 } else {
467 dvma_prot = __pgprot(SRMMU_ET_PTE | SRMMU_PRIV);
468 ioperm_noc = IOPTE_WRITE | IOPTE_VALID;
469 }
470}