Subject: EP7211 pgdir problem -- solved (+ARM kernel question)

From: Mike Touloumtzis <[email-masked]>
Date: Tue, 29 Aug 2000 11:08:33 -0700

Hello world,

Yesterday I resolved the EP7211 porting issue that I described on Saturday
(memory maps apparently not being updated by paging_init()).

The problem turned out to be that the initial 4MB identity mapping and
swapper_pg_dir don't overlap on the EP7211 because I'm leaving the first
128MB of DRAM reserved for video (this is a hardware-imposed constraint).

The identity mapping pgdir address is computed in head-armv.S assembly
language as:
	physical RAM start + SWAPPER_PGDIR_OFFSET
where SWAPPER_PGDIR_OFFSET is 0x4000.

The swapper_pg_dir mapping pgdir address is computed in a #define in
the same file as:
	TEXTADDR - 0x8000 + SWAPPER_PGDIR_OFFSET

All existing ARM architectures start the kernel image at 0x8000 past the
beginning of physical DRAM, so these computations produce the same
result.  It's not practical for EP7211 because of the aforementioned
video memory mapping issue.

Given this, can anyone tell me which of the following is correct:

(a) There is no assumption that the head-*.S identity mapping must lie
    at the same place as swapper_pg_dir.  There is a missing set_pgdir()
    to switch between them, but this hasn't come up because they currently
    happen to overlap, so the set_pgdir() would be a no-op.

(b) The identity mapping and swapper_pg_dir must always overlap, because
    the overwriting in-place of the identity mapping by paging_init()
    is intended.  Architectures which can't put TEXTADDR at (start of
    RAM + 0x8000) must modify one of the computations listed above to
    force an overlap.

(c) None of the above :-).

thanks,
miket

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

---

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

> 128MB of DRAM reserved for video (this is a hardware-imposed constraint).

Where precisely are you loading the kernel, and what are the start
addresses of physical and virtual RAM?

>     RAM + 0x8000) must modify one of the computations listed above to

Correct.  The table should be located at TEXTADDR - 0x4000, so the one
that is broken is in the page table code.
   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |        Russell King       [email-masked]      --- ---
  | | | |            http://www.arm.linux.org.uk/            /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |

---

From: Mike Touloumtzis <[email-masked]>
Date: Tue, 29 Aug 2000 12:13:31 -0700

> addresses of physical and virtual RAM?

Start of virtual RAM and physical RAM are both 0xc0000000.

Video RAM reserved area is 128K: 0xc0000000:0xc0020000.
The LCD controller in the 7211 can only use the very beginning of a
memory bank as video RAM.

Param block is 0xc0020000 -- right after video RAM.

TEXTADDR is 0xc0038000 (legacy of 2.2.1/Psion port; I'm thinking of
moving to 0xc0028000).  So right now, swapper_pg_dir is at 0xc0034000.

> that is broken is in the page table code.

To get things working for me, I made the following change in head-armv.S
(r5 is physical address of start or RAM):

__create_page_tables:
#       XXX miket: changing pgdir address from following
#               add     r4, r5, #SWAPPER_PGDIR_OFFSET
#       in order to handle the video RAM offset.
#       This is a quick hack fix, not a real solution.
                add     r4, r5, #0x00034000

miket

---

From: Mike Touloumtzis <[email-masked]>
Date: Tue, 29 Aug 2000 12:37:13 -0700

Just a suggestion about the TEXTADDR thing; if instead of (or in
addition to) TEXTADDR, we had a TEXT_OFFSET (which would tend to
be an acceptable ARM immediate value), the pgdir setup could
become something like:

		add	r4, r5, #TEXT_OFFSET
		sub	r4, r4, #SWAPPER_PGDIR_OFFSET

miket