aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386')
-rw-r--r--arch/i386/mm/highmem.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/arch/i386/mm/highmem.c b/arch/i386/mm/highmem.c
index ba44000b9069..f9f647cdbc7b 100644
--- a/arch/i386/mm/highmem.c
+++ b/arch/i386/mm/highmem.c
@@ -38,22 +38,19 @@ void *kmap_atomic(struct page *page, enum km_type type)
38 38
39 idx = type + KM_TYPE_NR*smp_processor_id(); 39 idx = type + KM_TYPE_NR*smp_processor_id();
40 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 40 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
41#ifdef CONFIG_DEBUG_HIGHMEM
42 if (!pte_none(*(kmap_pte-idx))) 41 if (!pte_none(*(kmap_pte-idx)))
43 BUG(); 42 BUG();
44#endif
45 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot)); 43 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
46 __flush_tlb_one(vaddr);
47 44
48 return (void*) vaddr; 45 return (void*) vaddr;
49} 46}
50 47
51void kunmap_atomic(void *kvaddr, enum km_type type) 48void kunmap_atomic(void *kvaddr, enum km_type type)
52{ 49{
53#ifdef CONFIG_DEBUG_HIGHMEM
54 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; 50 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
55 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); 51 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
56 52
53#ifdef CONFIG_DEBUG_HIGHMEM
57 if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) { 54 if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) {
58 dec_preempt_count(); 55 dec_preempt_count();
59 preempt_check_resched(); 56 preempt_check_resched();
@@ -62,14 +59,14 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
62 59
63 if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx)) 60 if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx))
64 BUG(); 61 BUG();
65 62#endif
66 /* 63 /*
67 * force other mappings to Oops if they'll try to access 64 * Force other mappings to Oops if they'll try to access this pte
68 * this pte without first remap it 65 * without first remap it. Keeping stale mappings around is a bad idea
66 * also, in case the page changes cacheability attributes or becomes
67 * a protected page in a hypervisor.
69 */ 68 */
70 pte_clear(&init_mm, vaddr, kmap_pte-idx); 69 kpte_clear_flush(kmap_pte-idx, vaddr);
71 __flush_tlb_one(vaddr);
72#endif
73 70
74 dec_preempt_count(); 71 dec_preempt_count();
75 preempt_check_resched(); 72 preempt_check_resched();
@@ -88,7 +85,6 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
88 idx = type + KM_TYPE_NR*smp_processor_id(); 85 idx = type + KM_TYPE_NR*smp_processor_id();
89 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 86 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
90 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); 87 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
91 __flush_tlb_one(vaddr);
92 88
93 return (void*) vaddr; 89 return (void*) vaddr;
94} 90}