Commit graph android_kernel_sony_sdm845/arch/microblaze/kernel/head.S
Message SHA1
microblaze: Handle TLB skip size dynamically
This patch fix the problem with rootfs on JFFS2 with early printk
console turned on.

The origin version used TLB63 for temporary early printk mapping.
The code expect that kernel is not able to use all 64 TLB entries
till early printk console is remapped by ioremap. After that
temporary mapping on TLB63 is silently lost.
This expectation give the opportunity to have early console pretty
early.

Microblaze systems with JFFS2 rootfs with early printk console turned on
used more than 64 TLB entries before kernel can remap early console.
Based on that kernel does access to bad area because early printk mapping
is rewritten.

This patch introduces tlb_skip variable which dynamically stores number
of skipped TLB entries from the TLB0. skip_tlb=2 means that TLB0 and TLB1
should be skipped.

MICROBLAZE_TLB_SKIP defines how many TLB is skipped at the kernel start.
They can be used for user purpose.

TLB 63 is used for temporary LMB mapping (MICROBLAZE_LMB_TLB_ID).

Also clean TLBLO when kernel starts.

For specific kernel sizes kernel can use just one TLB. Detect this case
and use the second TLB for general purpose.

Change _tlbia function to flush TLB entries from tlb_skip to TLB_SIZE.

Export tlb_skip size through debugfs.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2012-03-23 09:28:19 +01:00
e02db0aa3e
microblaze: Improve TLB calculation for small systems
Systems with small amount of memory need to be handled
differently. Linux can't allocate the whole 32MB with two TLBs
because then there is no MMU protection.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2012-03-23 09:28:18 +01:00
95b0f9ea66
microblaze: Extend space for compiled-in FDT to 32kB
Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2012-03-23 09:28:17 +01:00
3a1d26769f
microblaze: Clear all MSR flags on the first kernel instruction
The main reason is bug because of dynamic TLB allocation.
U-BOOT didn't disable dcache and then writing to physical address
from ASM wan't visible for reading through MMU.
Disabling caches and clearing all flags from previous code
is good to do so.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2012-03-23 09:28:16 +01:00
173701d774
microblaze: Do not use "la" pseudo instruction - use addik instead
"la" pseudo instruction is only translation to "addik".
Use directly "addik" which is described in the MB reference guide.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2011-03-09 08:09:54 +01:00
cd3415779b
microblaze: Optimize BE/LE bootup detecting
Save 0x1 word to rodata section and remove online value
loading if DTB is passed from bootloader. It saves two
asm instructions in bootup.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2011-03-09 08:09:53 +01:00
495162dfef
microblaze: Fix msr instruction detection
Fix msr instructions detection. The current code
just use msrclr for loading msr content and compare
it with proper MSR content. If msrclr is not implemented
r8 contains pc address.
Previous code wanted to use MSR carry bit but if msrclr
wasn't implemented carry wasn't cleared.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2011-02-07 19:13:01 +01:00
0eb6aaf529
microblaze: Fix DTB passing from bootloader
Little endian system needs to check OF_DT_HEADER
but it is swapped because it is in big-endian.
Microblaze LE provides lwr instruction which loads
magic number in BIG endian format which can be compared.

There is used the fact that if you write 0x1 as word
and load it as byte then you get for big-endian zero
and 1 for little-endian.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2011-01-28 14:04:36 +01:00
026a207879
microblaze: Allow PAGE_SIZE configuration
Allow developer to configure memory page size at compile time.
Larger pages can improve performance on some workloads.

Based on PowerPC code.

Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>

Steven J. Magnani   authored and   Michal Simek   commited 2010-08-04 10:22:34 +02:00
ba9c4f88d7
microblaze: Quiet section mismatch warnings
_start is located in .text, which causes mismatch warnings with
machine_early_init() and start_kernel() in .init.text.

Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>

Steven J. Magnani   authored and   Michal Simek   commited 2010-05-06 11:21:57 +02:00
7a0248e819
microblaze: head.S typo fix
I forget to change register name in comments.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2010-04-01 08:38:24 +02:00
3f21893586
microblaze: Use MICROBLAZE_TLB_SIZE in asm code
TLB size was hardcoded in asm code. This patch brings ability
to change TLB size only in one place. (mmu.h).

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2010-04-01 08:38:24 +02:00
0691c97d74
microblaze: Support systems without lmb bram
When the system has no lmb bram, main memory should be start from
zero because of microblaze vectors.

DTS fragment could look like:
	DDR2_SDRAM: memory@0 {
		device_type = "memory";
		reg = < 0x0 0x10000000 >;
	} ;

Then you have to setup CONFIG_KERNEL_BASE_ADDR=0 which caused
that kernel physical start address will be zero. On reset vector place
will be jump to 0x100 and on 0x100 starts kernel text.

You have to solve how to load the kernel before cpu starts.
Tested with XMD.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2010-04-01 08:38:23 +02:00
ee68f1745e
microblaze: Change temp register for cmdline
For copy was used r7 register when CONFIG_CMDLINE_BOOL option
is enabled. But r7 stores pointer to fdt that's why machine_early_init
not detect compiled-in DTB.

I also moved kernel PID setup to have TLB init in one block

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2010-03-11 14:08:55 +01:00
137d0795a7
of: add common header for flattened device tree representation
Add a common header file for working with the flattened device tree
data structure and merge the shared data tags used by Microblaze and
PowerPC

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Michal Simek <monstr@monstr.eu>
Acked-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>

Grant Likely   commited 2009-10-15 10:57:53 -06:00
d8678b5870
microblaze: Improve checking mechanism for MSR instruction
It is more safe to use clear instead of msrset.
We save some instructions too.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2009-09-21 14:29:21 +02:00
9002062ff5
microblaze: Add checking mechanism for MSR instruction
It was necessary to use fourth parameter(r8) in early_printk
to show messages on console.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2009-09-21 14:29:21 +02:00
2622434ee0
microblaze: Clear print messages for DTB passing via r7
It is necessary to zeroed r7 when r7 points to bad
dtb - this caused that we have correct messages
about compiled-in dtb or passing via r7

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2009-07-27 07:39:54 +02:00
ea3fd1466f
microblaze: Not to clear r7 after copying DTB to kernel
I can't clear r7 because if I do it I lose information
where DTB come from.

Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2009-07-27 07:39:54 +02:00
a69cb8c466
microblaze: Final support for statically linked DTB
If r7 is zero at kernel boot, or does not point to a valid DTB, then
we fall back to a DTB (assumed to be) linked statically in the kernel, instead
of blindly copying bogus cruft into the kernel DTB memory region

Signed-off-by: John Williams <john.williams@petalogix.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>

John Williams   authored and   Michal Simek   commited 2009-07-27 07:39:53 +02:00
909964ec89
microblaze_mmu_v2: MMU update for startup code
Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2009-05-26 16:45:14 +02:00
5846cc608f
microblaze_v8: assembler files head.S, entry-nommu.S, syscall_table.S
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Acked-by: John Linn <john.linn@xilinx.com>
Acked-by: John Williams <john.williams@petalogix.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>

Michal Simek   commited 2009-03-27 14:25:20 +01:00
6d5af1a35f