Commit 6b7c095a authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/83xx: map IMMR with a BAT.

On mpc83xx with a QE, IMMR is 2Mbytes and aligned on 2Mbytes boundarie.
On mpc83xx without a QE, IMMR is 1Mbyte and 1Mbyte aligned.

Each driver will map a part of it to access the registers it needs.
Some drivers will map the same part of IMMR as other drivers.

In order to reduce TLB misses, map the full IMMR with a BAT. If it is
2Mbytes aligned, map 2Mbytes. If there is no QE, the upper part will
remain unused, but it doesn't harm as it is mapped as guarded memory.

When the IMMR is not aligned on a 2Mbytes boundarie, only map 1Mbyte.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Acked-by: default avatarScott Wood <oss@buserror.net>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/269a00951328fb6fa1be2fa3cbc76c19745019b7.1568665466.git.christophe.leroy@c-s.fr
parent cbcaff7d
...@@ -63,6 +63,13 @@ enum fixed_addresses { ...@@ -63,6 +63,13 @@ enum fixed_addresses {
FIX_IMMR_START, FIX_IMMR_START,
FIX_IMMR_BASE = __ALIGN_MASK(FIX_IMMR_START, FIX_IMMR_SIZE - 1) - 1 + FIX_IMMR_BASE = __ALIGN_MASK(FIX_IMMR_START, FIX_IMMR_SIZE - 1) - 1 +
FIX_IMMR_SIZE, FIX_IMMR_SIZE,
#endif
#ifdef CONFIG_PPC_83xx
/* For IMMR we need an aligned 2M area */
#define FIX_IMMR_SIZE (SZ_2M / PAGE_SIZE)
FIX_IMMR_START,
FIX_IMMR_BASE = __ALIGN_MASK(FIX_IMMR_START, FIX_IMMR_SIZE - 1) - 1 +
FIX_IMMR_SIZE,
#endif #endif
/* FIX_PCIE_MCFG, */ /* FIX_PCIE_MCFG, */
__end_of_permanent_fixed_addresses, __end_of_permanent_fixed_addresses,
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <sysdev/fsl_soc.h> #include <sysdev/fsl_soc.h>
#include <sysdev/fsl_pci.h> #include <sysdev/fsl_pci.h>
#include <mm/mmu_decl.h>
#include "mpc83xx.h" #include "mpc83xx.h"
static __be32 __iomem *restart_reg_base; static __be32 __iomem *restart_reg_base;
...@@ -145,6 +147,15 @@ void __init mpc83xx_setup_arch(void) ...@@ -145,6 +147,15 @@ void __init mpc83xx_setup_arch(void)
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc83xx_setup_arch()", 0); ppc_md.progress("mpc83xx_setup_arch()", 0);
if (!__map_without_bats) {
phys_addr_t immrbase = get_immrbase();
int immrsize = IS_ALIGNED(immrbase, SZ_2M) ? SZ_2M : SZ_1M;
unsigned long va = fix_to_virt(FIX_IMMR_BASE);
setbat(-1, va, immrbase, immrsize, PAGE_KERNEL_NCG);
update_bats();
}
mpc83xx_setup_pci(); mpc83xx_setup_pci();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment