blob: e7ca7fc48d123d723be9e3efef3e63b1c34b74ba [file] [log] [blame]
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -07001/*
2 * Handle caching attributes in page tables (PAT)
3 *
4 * Authors: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Suresh B Siddha <suresh.b.siddha@intel.com>
6 *
7 * Loosely based on earlier PAT patchset from Eric Biederman and Andi Kleen.
8 */
9
10#include <linux/mm.h>
11#include <linux/kernel.h>
12#include <linux/gfp.h>
13#include <linux/fs.h>
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -070014#include <linux/bootmem.h>
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -070015
16#include <asm/msr.h>
17#include <asm/tlbflush.h>
18#include <asm/processor.h>
Venki Pallipadi0124cec2008-04-26 11:32:12 -070019#include <asm/page.h>
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -070020#include <asm/pgtable.h>
21#include <asm/pat.h>
22#include <asm/e820.h>
23#include <asm/cacheflush.h>
24#include <asm/fcntl.h>
25#include <asm/mtrr.h>
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -070026#include <asm/io.h>
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -070027
28int pat_wc_enabled = 1;
29
30static u64 __read_mostly boot_pat_state;
31
32static int nopat(char *str)
33{
34 pat_wc_enabled = 0;
35 printk(KERN_INFO "x86: PAT support disabled.\n");
36
37 return 0;
38}
39early_param("nopat", nopat);
40
41static int pat_known_cpu(void)
42{
43 if (!pat_wc_enabled)
44 return 0;
45
Yinghai Lu9307cac2008-03-24 23:24:34 -070046 if (cpu_has_pat)
47 return 1;
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -070048
49 pat_wc_enabled = 0;
50 printk(KERN_INFO "CPU and/or kernel does not support PAT.\n");
51 return 0;
52}
53
54enum {
55 PAT_UC = 0, /* uncached */
56 PAT_WC = 1, /* Write combining */
57 PAT_WT = 4, /* Write Through */
58 PAT_WP = 5, /* Write Protected */
59 PAT_WB = 6, /* Write Back (default) */
60 PAT_UC_MINUS = 7, /* UC, but can be overriden by MTRR */
61};
62
63#define PAT(x,y) ((u64)PAT_ ## y << ((x)*8))
64
65void pat_init(void)
66{
67 u64 pat;
68
69#ifndef CONFIG_X86_PAT
70 nopat(NULL);
71#endif
72
73 /* Boot CPU enables PAT based on CPU feature */
74 if (!smp_processor_id() && !pat_known_cpu())
75 return;
76
77 /* APs enable PAT iff boot CPU has enabled it before */
78 if (smp_processor_id() && !pat_wc_enabled)
79 return;
80
81 /* Set PWT to Write-Combining. All other bits stay the same */
82 /*
83 * PTE encoding used in Linux:
84 * PAT
85 * |PCD
86 * ||PWT
87 * |||
88 * 000 WB _PAGE_CACHE_WB
89 * 001 WC _PAGE_CACHE_WC
90 * 010 UC- _PAGE_CACHE_UC_MINUS
91 * 011 UC _PAGE_CACHE_UC
92 * PAT bit unused
93 */
94 pat = PAT(0,WB) | PAT(1,WC) | PAT(2,UC_MINUS) | PAT(3,UC) |
95 PAT(4,WB) | PAT(5,WC) | PAT(6,UC_MINUS) | PAT(7,UC);
96
97 /* Boot CPU check */
98 if (!smp_processor_id()) {
99 rdmsrl(MSR_IA32_CR_PAT, boot_pat_state);
100 }
101
102 wrmsrl(MSR_IA32_CR_PAT, pat);
103 printk(KERN_INFO "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n",
104 smp_processor_id(), boot_pat_state, pat);
105}
106
107#undef PAT
108
109static char *cattr_name(unsigned long flags)
110{
111 switch (flags & _PAGE_CACHE_MASK) {
112 case _PAGE_CACHE_UC: return "uncached";
113 case _PAGE_CACHE_UC_MINUS: return "uncached-minus";
114 case _PAGE_CACHE_WB: return "write-back";
115 case _PAGE_CACHE_WC: return "write-combining";
116 default: return "broken";
117 }
118}
119
120/*
121 * The global memtype list keeps track of memory type for specific
122 * physical memory areas. Conflicting memory types in different
123 * mappings can cause CPU cache corruption. To avoid this we keep track.
124 *
125 * The list is sorted based on starting address and can contain multiple
126 * entries for each address (this allows reference counting for overlapping
127 * areas). All the aliases have the same cache attributes of course.
128 * Zero attributes are represented as holes.
129 *
130 * Currently the data structure is a list because the number of mappings
131 * are expected to be relatively small. If this should be a problem
132 * it could be changed to a rbtree or similar.
133 *
134 * memtype_lock protects the whole list.
135 */
136
137struct memtype {
138 u64 start;
139 u64 end;
140 unsigned long type;
141 struct list_head nd;
142};
143
144static LIST_HEAD(memtype_list);
145static DEFINE_SPINLOCK(memtype_lock); /* protects memtype list */
146
147/*
148 * Does intersection of PAT memory type and MTRR memory type and returns
149 * the resulting memory type as PAT understands it.
150 * (Type in pat and mtrr will not have same value)
151 * The intersection is based on "Effective Memory Type" tables in IA-32
152 * SDM vol 3a
153 */
154static int pat_x_mtrr_type(u64 start, u64 end, unsigned long prot,
155 unsigned long *ret_prot)
156{
157 unsigned long pat_type;
158 u8 mtrr_type;
159
160 mtrr_type = mtrr_type_lookup(start, end);
161 if (mtrr_type == 0xFF) { /* MTRR not enabled */
162 *ret_prot = prot;
163 return 0;
164 }
165 if (mtrr_type == 0xFE) { /* MTRR match error */
166 *ret_prot = _PAGE_CACHE_UC;
167 return -1;
168 }
169 if (mtrr_type != MTRR_TYPE_UNCACHABLE &&
170 mtrr_type != MTRR_TYPE_WRBACK &&
171 mtrr_type != MTRR_TYPE_WRCOMB) { /* MTRR type unhandled */
172 *ret_prot = _PAGE_CACHE_UC;
173 return -1;
174 }
175
176 pat_type = prot & _PAGE_CACHE_MASK;
177 prot &= (~_PAGE_CACHE_MASK);
178
179 /* Currently doing intersection by hand. Optimize it later. */
180 if (pat_type == _PAGE_CACHE_WC) {
181 *ret_prot = prot | _PAGE_CACHE_WC;
182 } else if (pat_type == _PAGE_CACHE_UC_MINUS) {
183 *ret_prot = prot | _PAGE_CACHE_UC_MINUS;
184 } else if (pat_type == _PAGE_CACHE_UC ||
185 mtrr_type == MTRR_TYPE_UNCACHABLE) {
186 *ret_prot = prot | _PAGE_CACHE_UC;
187 } else if (mtrr_type == MTRR_TYPE_WRCOMB) {
188 *ret_prot = prot | _PAGE_CACHE_WC;
189 } else {
190 *ret_prot = prot | _PAGE_CACHE_WB;
191 }
192
193 return 0;
194}
195
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700196/*
197 * req_type typically has one of the:
198 * - _PAGE_CACHE_WB
199 * - _PAGE_CACHE_WC
200 * - _PAGE_CACHE_UC_MINUS
201 * - _PAGE_CACHE_UC
202 *
203 * req_type will have a special case value '-1', when requester want to inherit
204 * the memory type from mtrr (if WB), existing PAT, defaulting to UC_MINUS.
205 *
206 * If ret_type is NULL, function will return an error if it cannot reserve the
207 * region with req_type. If ret_type is non-null, function will return
208 * available type in ret_type in case of no error. In case of any error
209 * it will return a negative return value.
210 */
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700211int reserve_memtype(u64 start, u64 end, unsigned long req_type,
212 unsigned long *ret_type)
213{
214 struct memtype *new_entry = NULL;
215 struct memtype *parse;
216 unsigned long actual_type;
217 int err = 0;
218
219 /* Only track when pat_wc_enabled */
220 if (!pat_wc_enabled) {
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700221 /* This is identical to page table setting without PAT */
222 if (ret_type) {
223 if (req_type == -1) {
224 *ret_type = _PAGE_CACHE_WB;
225 } else {
226 *ret_type = req_type;
227 }
228 }
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700229 return 0;
230 }
231
232 /* Low ISA region is always mapped WB in page table. No need to track */
233 if (start >= ISA_START_ADDRESS && (end - 1) <= ISA_END_ADDRESS) {
234 if (ret_type)
235 *ret_type = _PAGE_CACHE_WB;
236
237 return 0;
238 }
239
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700240 if (req_type == -1) {
241 /*
242 * Special case where caller wants to inherit from mtrr or
243 * existing pat mapping, defaulting to UC_MINUS in case of
244 * no match.
245 */
246 u8 mtrr_type = mtrr_type_lookup(start, end);
247 if (mtrr_type == 0xFE) { /* MTRR match error */
248 err = -1;
249 }
250
251 if (mtrr_type == MTRR_TYPE_WRBACK) {
252 req_type = _PAGE_CACHE_WB;
253 actual_type = _PAGE_CACHE_WB;
254 } else {
255 req_type = _PAGE_CACHE_UC_MINUS;
256 actual_type = _PAGE_CACHE_UC_MINUS;
257 }
258 } else {
259 req_type &= _PAGE_CACHE_MASK;
260 err = pat_x_mtrr_type(start, end, req_type, &actual_type);
261 }
262
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700263 if (err) {
264 if (ret_type)
265 *ret_type = actual_type;
266
267 return -EINVAL;
268 }
269
270 new_entry = kmalloc(sizeof(struct memtype), GFP_KERNEL);
271 if (!new_entry)
272 return -ENOMEM;
273
274 new_entry->start = start;
275 new_entry->end = end;
276 new_entry->type = actual_type;
277
278 if (ret_type)
279 *ret_type = actual_type;
280
281 spin_lock(&memtype_lock);
282
283 /* Search for existing mapping that overlaps the current range */
284 list_for_each_entry(parse, &memtype_list, nd) {
285 struct memtype *saved_ptr;
286
287 if (parse->start >= end) {
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200288 pr_debug("New Entry\n");
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700289 list_add(&new_entry->nd, parse->nd.prev);
290 new_entry = NULL;
291 break;
292 }
293
294 if (start <= parse->start && end >= parse->start) {
295 if (actual_type != parse->type && ret_type) {
296 actual_type = parse->type;
297 *ret_type = actual_type;
298 new_entry->type = actual_type;
299 }
300
301 if (actual_type != parse->type) {
302 printk(
303 KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
304 current->comm, current->pid,
305 start, end,
306 cattr_name(actual_type),
307 cattr_name(parse->type));
308 err = -EBUSY;
309 break;
310 }
311
312 saved_ptr = parse;
313 /*
314 * Check to see whether the request overlaps more
315 * than one entry in the list
316 */
317 list_for_each_entry_continue(parse, &memtype_list, nd) {
318 if (end <= parse->start) {
319 break;
320 }
321
322 if (actual_type != parse->type) {
323 printk(
324 KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
325 current->comm, current->pid,
326 start, end,
327 cattr_name(actual_type),
328 cattr_name(parse->type));
329 err = -EBUSY;
330 break;
331 }
332 }
333
334 if (err) {
335 break;
336 }
337
Ingo Molnar1ebcc652008-04-26 11:40:31 +0200338 pr_debug("Overlap at 0x%Lx-0x%Lx\n",
venkatesh.pallipadi@intel.com6997ab42008-03-18 17:00:25 -0700339 saved_ptr->start, saved_ptr->end);
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700340 /* No conflict. Go ahead and add this new entry */
341 list_add(&new_entry->nd, saved_ptr->nd.prev);
342 new_entry = NULL;
343 break;
344 }
345
346 if (start < parse->end) {
347 if (actual_type != parse->type && ret_type) {
348 actual_type = parse->type;
349 *ret_type = actual_type;
350 new_entry->type = actual_type;
351 }
352
353 if (actual_type != parse->type) {
354 printk(
355 KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
356 current->comm, current->pid,
357 start, end,
358 cattr_name(actual_type),
359 cattr_name(parse->type));
360 err = -EBUSY;
361 break;
362 }
363
364 saved_ptr = parse;
365 /*
366 * Check to see whether the request overlaps more
367 * than one entry in the list
368 */
369 list_for_each_entry_continue(parse, &memtype_list, nd) {
370 if (end <= parse->start) {
371 break;
372 }
373
374 if (actual_type != parse->type) {
375 printk(
376 KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
377 current->comm, current->pid,
378 start, end,
379 cattr_name(actual_type),
380 cattr_name(parse->type));
381 err = -EBUSY;
382 break;
383 }
384 }
385
386 if (err) {
387 break;
388 }
389
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200390 printk(KERN_INFO "Overlap at 0x%Lx-0x%Lx\n",
venkatesh.pallipadi@intel.com6997ab42008-03-18 17:00:25 -0700391 saved_ptr->start, saved_ptr->end);
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700392 /* No conflict. Go ahead and add this new entry */
393 list_add(&new_entry->nd, &saved_ptr->nd);
394 new_entry = NULL;
395 break;
396 }
397 }
398
399 if (err) {
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200400 printk(KERN_INFO
venkatesh.pallipadi@intel.com6997ab42008-03-18 17:00:25 -0700401 "reserve_memtype failed 0x%Lx-0x%Lx, track %s, req %s\n",
402 start, end, cattr_name(new_entry->type),
403 cattr_name(req_type));
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700404 kfree(new_entry);
405 spin_unlock(&memtype_lock);
406 return err;
407 }
408
409 if (new_entry) {
410 /* No conflict. Not yet added to the list. Add to the tail */
411 list_add_tail(&new_entry->nd, &memtype_list);
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200412 pr_debug("New Entry\n");
413 }
venkatesh.pallipadi@intel.com6997ab42008-03-18 17:00:25 -0700414
415 if (ret_type) {
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200416 pr_debug(
venkatesh.pallipadi@intel.com6997ab42008-03-18 17:00:25 -0700417 "reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s, ret %s\n",
418 start, end, cattr_name(actual_type),
419 cattr_name(req_type), cattr_name(*ret_type));
420 } else {
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200421 pr_debug(
venkatesh.pallipadi@intel.com6997ab42008-03-18 17:00:25 -0700422 "reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s\n",
423 start, end, cattr_name(actual_type),
424 cattr_name(req_type));
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700425 }
426
427 spin_unlock(&memtype_lock);
428 return err;
429}
430
431int free_memtype(u64 start, u64 end)
432{
433 struct memtype *ml;
434 int err = -EINVAL;
435
436 /* Only track when pat_wc_enabled */
437 if (!pat_wc_enabled) {
438 return 0;
439 }
440
441 /* Low ISA region is always mapped WB. No need to track */
442 if (start >= ISA_START_ADDRESS && end <= ISA_END_ADDRESS) {
443 return 0;
444 }
445
446 spin_lock(&memtype_lock);
447 list_for_each_entry(ml, &memtype_list, nd) {
448 if (ml->start == start && ml->end == end) {
449 list_del(&ml->nd);
450 kfree(ml);
451 err = 0;
452 break;
453 }
454 }
455 spin_unlock(&memtype_lock);
456
457 if (err) {
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200458 printk(KERN_INFO "%s:%d freeing invalid memtype %Lx-%Lx\n",
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700459 current->comm, current->pid, start, end);
460 }
venkatesh.pallipadi@intel.com6997ab42008-03-18 17:00:25 -0700461
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200462 pr_debug("free_memtype request 0x%Lx-0x%Lx\n", start, end);
venkatesh.pallipadi@intel.com2e5d9c82008-03-18 17:00:14 -0700463 return err;
464}
465
venkatesh.pallipadi@intel.comf0970c12008-03-18 17:00:20 -0700466
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700467/*
468 * /dev/mem mmap interface. The memtype used for mapping varies:
469 * - Use UC for mappings with O_SYNC flag
470 * - Without O_SYNC flag, if there is any conflict in reserve_memtype,
471 * inherit the memtype from existing mapping.
472 * - Else use UC_MINUS memtype (for backward compatibility with existing
473 * X drivers.
474 */
venkatesh.pallipadi@intel.comf0970c12008-03-18 17:00:20 -0700475pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
476 unsigned long size, pgprot_t vma_prot)
477{
478 return vma_prot;
479}
480
Venki Pallipadi0124cec2008-04-26 11:32:12 -0700481#ifdef CONFIG_NONPROMISC_DEVMEM
482/* This check is done in drivers/char/mem.c in case of NONPROMISC_DEVMEM*/
483static inline int range_is_allowed(unsigned long pfn, unsigned long size)
484{
485 return 1;
486}
487#else
488static inline int range_is_allowed(unsigned long pfn, unsigned long size)
489{
490 u64 from = ((u64)pfn) << PAGE_SHIFT;
491 u64 to = from + size;
492 u64 cursor = from;
493
494 while (cursor < to) {
495 if (!devmem_is_allowed(pfn)) {
496 printk(KERN_INFO
497 "Program %s tried to access /dev/mem between %Lx->%Lx.\n",
498 current->comm, from, to);
499 return 0;
500 }
501 cursor += PAGE_SIZE;
502 pfn++;
503 }
504 return 1;
505}
506#endif /* CONFIG_NONPROMISC_DEVMEM */
507
venkatesh.pallipadi@intel.comf0970c12008-03-18 17:00:20 -0700508int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
509 unsigned long size, pgprot_t *vma_prot)
510{
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700511 u64 offset = ((u64) pfn) << PAGE_SHIFT;
512 unsigned long flags = _PAGE_CACHE_UC_MINUS;
513 unsigned long ret_flags;
514 int retval;
venkatesh.pallipadi@intel.comf0970c12008-03-18 17:00:20 -0700515
Venki Pallipadi0124cec2008-04-26 11:32:12 -0700516 if (!range_is_allowed(pfn, size))
517 return 0;
518
venkatesh.pallipadi@intel.comf0970c12008-03-18 17:00:20 -0700519 if (file->f_flags & O_SYNC) {
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700520 flags = _PAGE_CACHE_UC;
venkatesh.pallipadi@intel.comf0970c12008-03-18 17:00:20 -0700521 }
522
523#ifdef CONFIG_X86_32
524 /*
525 * On the PPro and successors, the MTRRs are used to set
526 * memory types for physical addresses outside main memory,
527 * so blindly setting UC or PWT on those pages is wrong.
528 * For Pentiums and earlier, the surround logic should disable
529 * caching for the high addresses through the KEN pin, but
530 * we maintain the tradition of paranoia in this code.
531 */
532 if (!pat_wc_enabled &&
533 ! ( test_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability) ||
534 test_bit(X86_FEATURE_K6_MTRR, boot_cpu_data.x86_capability) ||
535 test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) ||
536 test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability)) &&
537 (pfn << PAGE_SHIFT) >= __pa(high_memory)) {
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700538 flags = _PAGE_CACHE_UC;
venkatesh.pallipadi@intel.comf0970c12008-03-18 17:00:20 -0700539 }
540#endif
541
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700542 /*
543 * With O_SYNC, we can only take UC mapping. Fail if we cannot.
544 * Without O_SYNC, we want to get
545 * - WB for WB-able memory and no other conflicting mappings
546 * - UC_MINUS for non-WB-able memory with no other conflicting mappings
547 * - Inherit from confliting mappings otherwise
548 */
549 if (flags != _PAGE_CACHE_UC_MINUS) {
550 retval = reserve_memtype(offset, offset + size, flags, NULL);
551 } else {
552 retval = reserve_memtype(offset, offset + size, -1, &ret_flags);
553 }
554
555 if (retval < 0)
556 return 0;
557
558 flags = ret_flags;
559
560 if (pfn <= max_pfn_mapped &&
561 ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) {
562 free_memtype(offset, offset + size);
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200563 printk(KERN_INFO
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700564 "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n",
565 current->comm, current->pid,
566 cattr_name(flags),
567 offset, offset + size);
568 return 0;
569 }
570
571 *vma_prot = __pgprot((pgprot_val(*vma_prot) & ~_PAGE_CACHE_MASK) |
572 flags);
venkatesh.pallipadi@intel.comf0970c12008-03-18 17:00:20 -0700573 return 1;
574}
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700575
576void map_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
577{
578 u64 addr = (u64)pfn << PAGE_SHIFT;
579 unsigned long flags;
580 unsigned long want_flags = (pgprot_val(vma_prot) & _PAGE_CACHE_MASK);
581
582 reserve_memtype(addr, addr + size, want_flags, &flags);
583 if (flags != want_flags) {
Ingo Molnar28eb559b2008-04-03 10:14:33 +0200584 printk(KERN_INFO
venkatesh.pallipadi@intel.come7f260a2008-03-18 17:00:21 -0700585 "%s:%d /dev/mem expected mapping type %s for %Lx-%Lx, got %s\n",
586 current->comm, current->pid,
587 cattr_name(want_flags),
588 addr, addr + size,
589 cattr_name(flags));
590 }
591}
592
593void unmap_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
594{
595 u64 addr = (u64)pfn << PAGE_SHIFT;
596
597 free_memtype(addr, addr + size);
598}
599