cregit-Linux how code gets into the kernel

Release 4.18 arch/x86/mm/iomap_32.c

Directory: arch/x86/mm
/*
 * 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

PersonTokensPropCommitsCommitProp
Venkatesh Pallipadi2866.67%250.00%
Andrew Morton1126.19%125.00%
Ingo Molnar37.14%125.00%
Total42100.00%4100.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)); /* Filter out unsupported __PAGE_KERNEL* bits: */ pgprot_val(*prot) &= __default_kernel_pte_mask; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Venkatesh Pallipadi6778.82%133.33%
Juergen Gross910.59%133.33%
Dave Hansen910.59%133.33%
Total85100.00%3100.00%

EXPORT_SYMBOL_GPL(iomap_create_wc);
void iomap_free(resource_size_t base, unsigned long size) { io_free_memtype(base, base + size); }

Contributors

PersonTokensPropCommitsCommitProp
Venkatesh Pallipadi2095.24%150.00%
Peter Zijlstra14.76%150.00%
Total21100.00%2100.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

PersonTokensPropCommitsCommitProp
Keith Packard6181.33%116.67%
Peter Zijlstra810.67%116.67%
David Hildenbrand34.00%116.67%
Ingo Molnar11.33%116.67%
Eric Anholt11.33%116.67%
Akinobu Mita11.33%116.67%
Total75100.00%6100.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)); /* Filter out unsupported __PAGE_KERNEL* bits: */ pgprot_val(prot) &= __default_kernel_pte_mask; return (void __force __iomem *) kmap_atomic_prot_pfn(pfn, prot); }

Contributors

PersonTokensPropCommitsCommitProp
Keith Packard1930.65%112.50%
Eric Anholt1219.35%112.50%
Juergen Gross914.52%112.50%
Dave Hansen812.90%112.50%
Francisco Jerez711.29%112.50%
Borislav Petkov46.45%112.50%
Akinobu Mita23.23%112.50%
Luis R. Rodriguez11.61%112.50%
Total62100.00%8100.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

PersonTokensPropCommitsCommitProp
Keith Packard4749.47%120.00%
Peter Zijlstra4446.32%240.00%
David Hildenbrand33.16%120.00%
Francisco Jerez11.05%120.00%
Total95100.00%5100.00%

EXPORT_SYMBOL_GPL(iounmap_atomic);

Overall Contributors

PersonTokensPropCommitsCommitProp
Keith Packard14334.54%15.26%
Venkatesh Pallipadi12129.23%210.53%
Peter Zijlstra5413.04%210.53%
Juergen Gross184.35%15.26%
Dave Hansen174.11%15.26%
Eric Anholt163.86%15.26%
Andrew Morton112.66%15.26%
Ingo Molnar81.93%210.53%
Francisco Jerez81.93%15.26%
David Hildenbrand61.45%15.26%
Akinobu Mita61.45%315.79%
Borislav Petkov40.97%15.26%
Paul Gortmaker10.24%15.26%
Luis R. Rodriguez10.24%15.26%
Total414100.00%19100.00%
Directory: arch/x86/mm
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.