Release 4.14 arch/x86/mm/iomap_32.c
/*
* Copyright © 2008 Ingo Molnar
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include <asm/iomap.h>
#include <asm/pat.h>
#include <linux/export.h>
#include <linux/highmem.h>
static int is_io_mapping_possible(resource_size_t base, unsigned long size)
{
#if !defined(CONFIG_X86_PAE) && defined(CONFIG_PHYS_ADDR_T_64BIT)
/* There is no way to map greater than 1 << 32 address without PAE */
if (base + size > 0x100000000ULL)
return 0;
#endif
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Venkatesh Pallipadi | 28 | 66.67% | 2 | 50.00% |
Andrew Morton | 11 | 26.19% | 1 | 25.00% |
Ingo Molnar | 3 | 7.14% | 1 | 25.00% |
Total | 42 | 100.00% | 4 | 100.00% |
int iomap_create_wc(resource_size_t base, unsigned long size, pgprot_t *prot)
{
enum page_cache_mode pcm = _PAGE_CACHE_MODE_WC;
int ret;
if (!is_io_mapping_possible(base, size))
return -EINVAL;
ret = io_reserve_memtype(base, base + size, &pcm);
if (ret)
return ret;
*prot = __pgprot(__PAGE_KERNEL | cachemode2protval(pcm));
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Venkatesh Pallipadi | 67 | 88.16% | 1 | 50.00% |
Juergen Gross | 9 | 11.84% | 1 | 50.00% |
Total | 76 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL_GPL(iomap_create_wc);
void iomap_free(resource_size_t base, unsigned long size)
{
io_free_memtype(base, base + size);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Venkatesh Pallipadi | 20 | 95.24% | 1 | 50.00% |
Peter Zijlstra | 1 | 4.76% | 1 | 50.00% |
Total | 21 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL_GPL(iomap_free);
void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot)
{
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, prot));
arch_flush_lazy_mmu_mode();
return (void *)vaddr;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith Packard | 61 | 81.33% | 1 | 16.67% |
Peter Zijlstra | 8 | 10.67% | 1 | 16.67% |
David Hildenbrand | 3 | 4.00% | 1 | 16.67% |
Ingo Molnar | 1 | 1.33% | 1 | 16.67% |
Akinobu Mita | 1 | 1.33% | 1 | 16.67% |
Eric Anholt | 1 | 1.33% | 1 | 16.67% |
Total | 75 | 100.00% | 6 | 100.00% |
/*
* Map 'pfn' using protections 'prot'
*/
void __iomem *
iomap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot)
{
/*
* For non-PAT systems, translate non-WB request to UC- just in
* case the caller set the PWT bit to prot directly without using
* pgprot_writecombine(). UC- translates to uncached if the MTRR
* is UC or WC. UC- gets the real intention, of the user, which is
* "WC if the MTRR is WC, UC if you can't do that."
*/
if (!pat_enabled() && pgprot2cachemode(prot) != _PAGE_CACHE_MODE_WB)
prot = __pgprot(__PAGE_KERNEL |
cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS));
return (void __force __iomem *) kmap_atomic_prot_pfn(pfn, prot);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith Packard | 19 | 35.19% | 1 | 14.29% |
Eric Anholt | 12 | 22.22% | 1 | 14.29% |
Juergen Gross | 9 | 16.67% | 1 | 14.29% |
Francisco Jerez | 7 | 12.96% | 1 | 14.29% |
Borislav Petkov | 4 | 7.41% | 1 | 14.29% |
Akinobu Mita | 2 | 3.70% | 1 | 14.29% |
Luis R. Rodriguez | 1 | 1.85% | 1 | 14.29% |
Total | 54 | 100.00% | 7 | 100.00% |
EXPORT_SYMBOL_GPL(iomap_atomic_prot_pfn);
void
iounmap_atomic(void __iomem *kvaddr)
{
unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
if (vaddr >= __fix_to_virt(FIX_KMAP_END) &&
vaddr <= __fix_to_virt(FIX_KMAP_BEGIN)) {
int idx, type;
type = kmap_atomic_idx();
idx = type + KM_TYPE_NR * smp_processor_id();
#ifdef CONFIG_DEBUG_HIGHMEM
WARN_ON_ONCE(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
#endif
/*
* Force other mappings to Oops if they'll try to access this
* pte without first remap it. Keeping stale mappings around
* is a bad idea also, in case the page changes cacheability
* attributes or becomes a protected page in a hypervisor.
*/
kpte_clear_flush(kmap_pte-idx, vaddr);
kmap_atomic_idx_pop();
}
pagefault_enable();
preempt_enable();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith Packard | 47 | 49.47% | 1 | 20.00% |
Peter Zijlstra | 44 | 46.32% | 2 | 40.00% |
David Hildenbrand | 3 | 3.16% | 1 | 20.00% |
Francisco Jerez | 1 | 1.05% | 1 | 20.00% |
Total | 95 | 100.00% | 5 | 100.00% |
EXPORT_SYMBOL_GPL(iounmap_atomic);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith Packard | 143 | 36.02% | 1 | 5.56% |
Venkatesh Pallipadi | 121 | 30.48% | 2 | 11.11% |
Peter Zijlstra | 54 | 13.60% | 2 | 11.11% |
Juergen Gross | 18 | 4.53% | 1 | 5.56% |
Eric Anholt | 16 | 4.03% | 1 | 5.56% |
Andrew Morton | 11 | 2.77% | 1 | 5.56% |
Francisco Jerez | 8 | 2.02% | 1 | 5.56% |
Ingo Molnar | 8 | 2.02% | 2 | 11.11% |
Akinobu Mita | 6 | 1.51% | 3 | 16.67% |
David Hildenbrand | 6 | 1.51% | 1 | 5.56% |
Borislav Petkov | 4 | 1.01% | 1 | 5.56% |
Paul Gortmaker | 1 | 0.25% | 1 | 5.56% |
Luis R. Rodriguez | 1 | 0.25% | 1 | 5.56% |
Total | 397 | 100.00% | 18 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.