You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
x86, 64-bit: unify early_ioremap
The 32-bit early_ioremap will work equally well for 64-bit, so just use it. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Cc: xen-devel <xen-devel@lists.xensource.com> Cc: Stephen Tweedie <sct@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
bb23e403e5
commit
4583ed514e
@@ -257,58 +257,6 @@ static __meminit void unmap_low_page(void *adr)
|
||||
early_iounmap(adr, PAGE_SIZE);
|
||||
}
|
||||
|
||||
/* Must run before zap_low_mappings */
|
||||
__meminit void *early_ioremap(unsigned long addr, unsigned long size)
|
||||
{
|
||||
pmd_t *pmd, *last_pmd;
|
||||
unsigned long vaddr;
|
||||
int i, pmds;
|
||||
|
||||
pmds = ((addr & ~PMD_MASK) + size + ~PMD_MASK) / PMD_SIZE;
|
||||
vaddr = __START_KERNEL_map;
|
||||
pmd = level2_kernel_pgt;
|
||||
last_pmd = level2_kernel_pgt + PTRS_PER_PMD - 1;
|
||||
|
||||
for (; pmd <= last_pmd; pmd++, vaddr += PMD_SIZE) {
|
||||
for (i = 0; i < pmds; i++) {
|
||||
if (pmd_present(pmd[i]))
|
||||
goto continue_outer_loop;
|
||||
}
|
||||
vaddr += addr & ~PMD_MASK;
|
||||
addr &= PMD_MASK;
|
||||
|
||||
for (i = 0; i < pmds; i++, addr += PMD_SIZE)
|
||||
set_pmd(pmd+i, __pmd(addr | __PAGE_KERNEL_LARGE_EXEC));
|
||||
__flush_tlb_all();
|
||||
|
||||
return (void *)vaddr;
|
||||
continue_outer_loop:
|
||||
;
|
||||
}
|
||||
printk(KERN_ERR "early_ioremap(0x%lx, %lu) failed\n", addr, size);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* To avoid virtual aliases later:
|
||||
*/
|
||||
__meminit void early_iounmap(void *addr, unsigned long size)
|
||||
{
|
||||
unsigned long vaddr;
|
||||
pmd_t *pmd;
|
||||
int i, pmds;
|
||||
|
||||
vaddr = (unsigned long)addr;
|
||||
pmds = ((vaddr & ~PMD_MASK) + size + ~PMD_MASK) / PMD_SIZE;
|
||||
pmd = level2_kernel_pgt + pmd_index(vaddr);
|
||||
|
||||
for (i = 0; i < pmds; i++)
|
||||
pmd_clear(pmd + i);
|
||||
|
||||
__flush_tlb_all();
|
||||
}
|
||||
|
||||
static unsigned long __meminit
|
||||
phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
|
||||
{
|
||||
|
||||
@@ -381,8 +381,6 @@ void unxlate_dev_mem_ptr(unsigned long phys, void *addr)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
|
||||
int __initdata early_ioremap_debug;
|
||||
|
||||
static int __init early_ioremap_debug_setup(char *str)
|
||||
@@ -483,6 +481,7 @@ static void __init __early_set_fixmap(enum fixed_addresses idx,
|
||||
return;
|
||||
}
|
||||
pte = early_ioremap_pte(addr);
|
||||
|
||||
if (pgprot_val(flags))
|
||||
set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
|
||||
else
|
||||
@@ -624,5 +623,3 @@ void __this_fixmap_does_not_exist(void)
|
||||
{
|
||||
WARN_ON(1);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_X86_32 */
|
||||
|
||||
Reference in New Issue
Block a user