Subject: RE: slower decompress?

From: Nicolas Pitre <[email-masked]>
Date: Tue, 22 Aug 2000 17:57:35 -0400 (EDT)

On Tue, 22 Aug 2000, Chris Blazie wrote:

> 
> > Ha!  That's the reason.
> > 
> > The code in head.S is only activating the cache from the start of
> > RAM.  The solution would be also to activate the cache for 2 MB from
> > the run-time address of "start".  
> 
> 	I'm not sure what you mean by "start" here -- you mean the
> execution address in Flash or the start address in RAM (0xc0008000) or
> something else?  Also is there a way to implement a generic solution here?
> I'm surely not the only one executing zImage from Flash.

Here's what could be done.  Beware that I didn't test it yet.

--- orig/linux/arch/arm/boot/compressed/head.S	Tue Aug 15 15:02:07 2000
+++ linux/arch/arm/boot/compressed/head.S	Tue Aug 22 17:12:47 2000
@@ -198,7 +198,6 @@
 1:
 		sub	r3, r4, #16384		@ Page directory size
 		bic	r3, r3, #0xff		@ Align the pointer
-		bic	r3, r3, #0x3f
 /*
  * Initialise the page tables
  */
@@ -217,6 +216,20 @@
 		add	r1, r1, #1048576
 		teq	r0, r2
 		bne	1b
+/*
+ * If ever we are running from Flash, then we surely want the cache
+ * to be enabled also for our execution instance...  We map 2MB of it
+ * so there is no overlap problem for up to 1 MB compressed kernel.
+ * If the execution is in RAM then we'll only duplicate the above.
+ */
+		mov	r1, #0x1e
+		orr	r1, r1, #3 << 10
+		mov	r2, pc, lsr #20
+		orr	r1, r1, r2, lsl #20
+		add	r0, r3, r2, lsl #2
+		str	r1, [r0], #4
+		add	r1, r1, #1048576
+		str	r1, [r0]
 
 		mov	r0, #0
 		mcr	p15, 0, r0, c7, c10, 4	@ drain write buffer

unsubscribe: body of `unsubscribe linux-arm-kernel' to [email-masked]

---

From: Russell King - ARM Linux Admin <[email-masked]>
Date: Tue, 22 Aug 2000 23:38:29 +0100 (BST)

> +++ linux/arch/arm/boot/compressed/head.S	Tue Aug 22 17:12:47 2000

Oops, there's a couple of '0's missing off the end of that line, so it should
probably be:

-		bic	r3, r3, #0x3f
+		bic	r3, r3, #0x3f00
   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |        Russell King       [email-masked]      --- ---
  | | | |            http://www.arm.linux.org.uk/            /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |

---

From: Chris Blazie <[email-masked]>
Date: Wed, 23 Aug 2000 10:33:25 -0400 (EDT)

> Here's what could be done.  Beware that I didn't test it yet.
[snip]

	I tested your changes and it works great, booting both from Flash
and RAM.  Thanks Nicolas!

Chris