Release 4.14 arch/mips/mm/highmem.c
// SPDX-License-Identifier: GPL-2.0
#include <linux/compiler.h>
#include <linux/init.h>
#include <linux/export.h>
#include <linux/highmem.h>
#include <linux/sched.h>
#include <linux/smp.h>
#include <asm/fixmap.h>
#include <asm/tlbflush.h>
static pte_t *kmap_pte;
unsigned long highstart_pfn, highend_pfn;
void *kmap(struct page *page)
{
void *addr;
might_sleep();
if (!PageHighMem(page))
return page_address(page);
addr = kmap_high(page);
flush_tlb_one((unsigned long)addr);
return addr;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ralf Bächle | 45 | 88.24% | 1 | 25.00% |
Dave Hansen | 4 | 7.84% | 1 | 25.00% |
Andrew Morton | 1 | 1.96% | 1 | 25.00% |
Peter Zijlstra | 1 | 1.96% | 1 | 25.00% |
Total | 51 | 100.00% | 4 | 100.00% |
EXPORT_SYMBOL(kmap);
void kunmap(struct page *page)
{
BUG_ON(in_interrupt());
if (!PageHighMem(page))
return;
kunmap_high(page);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ralf Bächle | 25 | 83.33% | 2 | 50.00% |
Dave Hansen | 4 | 13.33% | 1 | 25.00% |
Peter Zijlstra | 1 | 3.33% | 1 | 25.00% |
Total | 30 | 100.00% | 4 | 100.00% |
EXPORT_SYMBOL(kunmap);
/*
* kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
* no global lock is needed and because the kmap code must perform a global TLB
* invalidation when the kmap pool wraps.
*
* However when holding an atomic kmap is is not legal to sleep, so atomic
* kmaps are appropriate for short, tight code paths only.
*/
void *kmap_atomic(struct page *page)
{
unsigned long vaddr;
int idx, type;
preempt_disable();
pagefault_disable();
if (!PageHighMem(page))
return page_address(page);
type = kmap_atomic_idx_push();
idx = type + KM_TYPE_NR*smp_processor_id();
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
#ifdef CONFIG_DEBUG_HIGHMEM
BUG_ON(!pte_none(*(kmap_pte - idx)));
#endif
set_pte(kmap_pte-idx, mk_pte(page, PAGE_KERNEL));
local_flush_tlb_one((unsigned long)vaddr);
return (void*) vaddr;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ralf Bächle | 93 | 83.04% | 3 | 33.33% |
Peter Zijlstra | 9 | 8.04% | 2 | 22.22% |
Dave Hansen | 4 | 3.57% | 1 | 11.11% |
David Hildenbrand | 3 | 2.68% | 1 | 11.11% |
Akinobu Mita | 2 | 1.79% | 1 | 11.11% |
Américo Wang | 1 | 0.89% | 1 | 11.11% |
Total | 112 | 100.00% | 9 | 100.00% |
EXPORT_SYMBOL(kmap_atomic);
void __kunmap_atomic(void *kvaddr)
{
unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
int type __maybe_unused;
if (vaddr < FIXADDR_START) { // FIXME
pagefault_enable();
preempt_enable();
return;
}
type = kmap_atomic_idx();
#ifdef CONFIG_DEBUG_HIGHMEM
{
int idx = type + KM_TYPE_NR * smp_processor_id();
BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
/*
* force other mappings to Oops if they'll try to access
* this pte without first remap it
*/
pte_clear(&init_mm, vaddr, kmap_pte-idx);
local_flush_tlb_one(vaddr);
}
#endif
kmap_atomic_idx_pop();
pagefault_enable();
preempt_enable();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ralf Bächle | 59 | 57.84% | 3 | 33.33% |
Peter Zijlstra | 28 | 27.45% | 3 | 33.33% |
David Hildenbrand | 6 | 5.88% | 1 | 11.11% |
David S. Miller | 5 | 4.90% | 1 | 11.11% |
Andrew Morton | 4 | 3.92% | 1 | 11.11% |
Total | 102 | 100.00% | 9 | 100.00% |
EXPORT_SYMBOL(__kunmap_atomic);
/*
* This is the same as kmap_atomic() but can map memory that doesn't
* have a struct page associated with it.
*/
void *kmap_atomic_pfn(unsigned long pfn)
{
unsigned long vaddr;
int idx, type;
preempt_disable();
pagefault_disable();
type = kmap_atomic_idx_push();
idx = type + KM_TYPE_NR*smp_processor_id();
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
set_pte(kmap_pte-idx, pfn_pte(pfn, PAGE_KERNEL));
flush_tlb_one(vaddr);
return (void*) vaddr;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ralf Bächle | 60 | 81.08% | 2 | 33.33% |
Peter Zijlstra | 9 | 12.16% | 2 | 33.33% |
David Hildenbrand | 3 | 4.05% | 1 | 16.67% |
Akinobu Mita | 2 | 2.70% | 1 | 16.67% |
Total | 74 | 100.00% | 6 | 100.00% |
void __init kmap_init(void)
{
unsigned long kmap_vstart;
/* cache the first kmap pte */
kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN);
kmap_pte = kmap_get_fixmap_pte(kmap_vstart);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ralf Bächle | 27 | 100.00% | 2 | 100.00% |
Total | 27 | 100.00% | 2 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ralf Bächle | 355 | 78.19% | 6 | 31.58% |
Peter Zijlstra | 51 | 11.23% | 3 | 15.79% |
Dave Hansen | 12 | 2.64% | 1 | 5.26% |
David Hildenbrand | 12 | 2.64% | 1 | 5.26% |
David S. Miller | 5 | 1.10% | 1 | 5.26% |
Andrew Morton | 5 | 1.10% | 2 | 10.53% |
Akinobu Mita | 4 | 0.88% | 1 | 5.26% |
Paul Gortmaker | 4 | 0.88% | 1 | 5.26% |
Yoichi Yuasa | 3 | 0.66% | 1 | 5.26% |
Américo Wang | 2 | 0.44% | 1 | 5.26% |
Greg Kroah-Hartman | 1 | 0.22% | 1 | 5.26% |
Total | 454 | 100.00% | 19 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.