Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e378098 authored by Mark Salter's avatar Mark Salter Committed by Venkatesh Yadav Abbarapu
Browse files

arm: add early_ioremap support

This patch uses the generic early_ioremap code to implement
early_ioremap for ARM. The ARM-specific bits come mostly from
an earlier patch from Leif Lindholm <leif.lindholm@linaro.org>
here :

	 https://lkml.org/lkml/2013/10/3/279



Change-Id: I523875442caa8ecf61cc170ed3b72a612ac93427
Signed-off-by: default avatarMark Salter <msalter@redhat.com>
Tested-by: default avatarLeif Lindholm <leif.lindholm@linaro.org>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
[robh: minor re-work in prep for permanent mappings. Fix bug in page
table allocation size. Rework CONFIG_MMU dependency.]
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Git-commit: 24293625537e095c2d5bcc5a63dd23dfaf062ffc
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git


[vabbar@codeaurora.org: Fixed trivial merge conflicts]
Signed-off-by: default avatarVenkatesh Yadav Abbarapu <vabbar@codeaurora.org>
parent 79704243
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -97,6 +97,17 @@ config ARM_DMA_USE_IOMMU
	select ARM_HAS_SG_CHAIN
	select NEED_SG_DMA_LENGTH

config EARLY_IOREMAP
       bool "Provide early_ioremap() support for kernel initialization"
       depends on MMU
       select GENERIC_EARLY_IOREMAP
       help
         Provide a mechanism for kernel initialisation code to temporarily
         map, in a highmem-agnostic way, memory pages in before ioremap()
         and friends are available (before paging_init() has run). It uses
         the same virtual memory range as kmap so all early mappings must
         be unmapped before paging_init() is called.

if ARM_DMA_USE_IOMMU

config ARM_DMA_IOMMU_ALIGNMENT
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ generic-y += auxvec.h
generic-y += bitsperlong.h
generic-y += cputime.h
generic-y += current.h
generic-y += early_ioremap.h
generic-y += emergency-restart.h
generic-y += errno.h
generic-y += exec.h
+29 −2
Original line number Diff line number Diff line
#ifndef _ASM_FIXMAP_H
#define _ASM_FIXMAP_H

#include <linux/kernel.h>
#include <asm/pgtable.h>
#include <asm/kmap_types.h>

#define FIXADDR_START		0xffc00000UL
#define FIXADDR_END		0xfff00000UL
#define FIXADDR_TOP		(FIXADDR_END - PAGE_SIZE)

/*
 * 224 temporary boot-time mappings, used by early_ioremap(),
 * before ioremap() is functional.
 *
 * (P)re-using the FIXADDR region, which is used for highmem
 * later on, and statically aligned to 1MB.
 */
#define NR_FIX_BTMAPS          32
#define FIX_BTMAPS_SLOTS       7
#define TOTAL_FIX_BTMAPS       (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)

enum fixed_addresses {
	FIX_KMAP_BEGIN,
	FIX_EARLYCON_MEM_BASE,
	__end_of_permanent_fixed_addresses,
	FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
	FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,

	FIX_KMAP_BEGIN = __end_of_permanent_fixed_addresses,
	FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1,
	__end_of_fixed_addresses
	 __end_of_fixed_addresses = (FIXADDR_END - FIXADDR_START) >> PAGE_SHIFT,
};

#define FIXMAP_PAGE_COMMON (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN)

#define FIXMAP_PAGE_NORMAL (FIXMAP_PAGE_COMMON | L_PTE_MT_WRITEBACK)
#define FIXMAP_PAGE_IO    (FIXMAP_PAGE_COMMON | L_PTE_MT_DEV_SHARED | L_PTE_SHARED | L_PTE_DIRTY)
#define FIXMAP_PAGE_NOCACHE FIXMAP_PAGE_IO

extern void __early_set_fixmap(enum fixed_addresses idx,
					phys_addr_t phys, pgprot_t flags);

#include <asm-generic/fixmap.h>

#endif
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <asm/byteorder.h>
#include <asm/memory.h>
#include <asm-generic/pci_iomap.h>
#include <asm/early_ioremap.h>
#include <linux/msm_rtb.h>
#include <xen/xen.h>

+1 −0
Original line number Diff line number Diff line
@@ -906,6 +906,7 @@ void __init setup_arch(char **cmdline_p)
	const struct machine_desc *mdesc;

	setup_processor();
	early_ioremap_init();
	mdesc = setup_machine_fdt(__atags_pointer);
	if (!mdesc)
		mdesc = setup_machine_tags(__atags_pointer, __machine_arch_type);
Loading