mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 11:44:01 +08:00
ARM: pgtable: provide get_top_pte() to complement set_top_pte()
Provide get_top_pte() to complement set_top_pte(), moving the only users of TOP_PTE to arch/arm/mm/mm.h. Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
67ece14431
commit
0d31fe47b0
@ -69,7 +69,7 @@ void *__kmap_atomic(struct page *page)
|
|||||||
* With debugging enabled, kunmap_atomic forces that entry to 0.
|
* With debugging enabled, kunmap_atomic forces that entry to 0.
|
||||||
* Make sure it was indeed properly unmapped.
|
* Make sure it was indeed properly unmapped.
|
||||||
*/
|
*/
|
||||||
BUG_ON(!pte_none(*(TOP_PTE(vaddr))));
|
BUG_ON(!pte_none(get_top_pte(vaddr)));
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* When debugging is off, kunmap_atomic leaves the previous mapping
|
* When debugging is off, kunmap_atomic leaves the previous mapping
|
||||||
@ -119,7 +119,7 @@ void *kmap_atomic_pfn(unsigned long pfn)
|
|||||||
idx = type + KM_TYPE_NR * smp_processor_id();
|
idx = type + KM_TYPE_NR * smp_processor_id();
|
||||||
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
|
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
|
||||||
#ifdef CONFIG_DEBUG_HIGHMEM
|
#ifdef CONFIG_DEBUG_HIGHMEM
|
||||||
BUG_ON(!pte_none(*(TOP_PTE(vaddr))));
|
BUG_ON(!pte_none(get_top_pte(vaddr)));
|
||||||
#endif
|
#endif
|
||||||
set_top_pte(vaddr, pfn_pte(pfn, kmap_prot));
|
set_top_pte(vaddr, pfn_pte(pfn, kmap_prot));
|
||||||
|
|
||||||
@ -129,11 +129,9 @@ void *kmap_atomic_pfn(unsigned long pfn)
|
|||||||
struct page *kmap_atomic_to_page(const void *ptr)
|
struct page *kmap_atomic_to_page(const void *ptr)
|
||||||
{
|
{
|
||||||
unsigned long vaddr = (unsigned long)ptr;
|
unsigned long vaddr = (unsigned long)ptr;
|
||||||
pte_t *pte;
|
|
||||||
|
|
||||||
if (vaddr < FIXADDR_START)
|
if (vaddr < FIXADDR_START)
|
||||||
return virt_to_page(ptr);
|
return virt_to_page(ptr);
|
||||||
|
|
||||||
pte = TOP_PTE(vaddr);
|
return pte_page(get_top_pte(vaddr));
|
||||||
return pte_page(*pte);
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,11 @@ static inline void set_top_pte(unsigned long va, pte_t pte)
|
|||||||
local_flush_tlb_kernel_page(va);
|
local_flush_tlb_kernel_page(va);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline pte_t get_top_pte(unsigned long va)
|
||||||
|
{
|
||||||
|
return *TOP_PTE(va);
|
||||||
|
}
|
||||||
|
|
||||||
static inline pmd_t *pmd_off_k(unsigned long virt)
|
static inline pmd_t *pmd_off_k(unsigned long virt)
|
||||||
{
|
{
|
||||||
return pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt);
|
return pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt);
|
||||||
|
Loading…
Reference in New Issue
Block a user