Subject: Re: yamt-km branch
To: None <chuq@chuq.com>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 02/19/2005 12:54:07
--NextPart-20050219124519-0661200
Content-Type: Text/Plain; charset=us-ascii
hi,
> > > the problem that uvm_km_check_empty() noticed is from the call in
> > > pmap_init_md(). here we try to claim the virtual space which is already
> > > backed by PTEs set up back in pmap_bootstrap(). hopefully we can just
> > > use the normal pmap interfaces to create those mappings later, but I haven't
> > > tried it yet.
> >
> > is there any reason these areas are reserved using uvm_map,
> > rather than using the same way as kernel text? merely to save some va?
>
> no good reason that I know of. I'd be fine with doing it that way.
> if you write it, I'll test it. :-)
i wrote a patch for mac68k. (attached)
i'm not sure if wasting this kva (thus possibly some static pt pages) is
acceptable for these platforms, though.
if it isn't, i guess it's better to change address layout so that
the available region is contiguous. maybe move Sysmap to the end of
address space?
YAMAMOTO Takashi
--NextPart-20050219124519-0661200
Content-Type: Text/Plain; charset=us-ascii
Content-Disposition: attachment; filename="a.diff"
Index: mac68k/mac68k/pmap_bootstrap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/mac68k/pmap_bootstrap.c,v
retrieving revision 1.61.4.1
diff -u -p -r1.61.4.1 pmap_bootstrap.c
--- mac68k/mac68k/pmap_bootstrap.c 12 Feb 2005 18:17:35 -0000 1.61.4.1
+++ mac68k/mac68k/pmap_bootstrap.c 19 Feb 2005 03:23:45 -0000
@@ -359,12 +359,14 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f
* Pages up to "start" must be writable for the ROM.
*/
pte = &(PA2VA(kptpa, u_int *))[m68k_btop(KERNBASE)];
+ /* XXX why KERNBASE relative? */
epte = &pte[m68k_btop(m68k_round_page(start))];
protopte = firstpa | PG_RW | PG_V;
while (pte < epte) {
*pte++ = protopte;
protopte += PAGE_SIZE;
}
+ /* XXX why KERNBASE relative? */
epte = &pte[m68k_btop(m68k_trunc_page(&etext))];
protopte = (protopte & ~PG_PROT) | PG_RO;
while (pte < epte) {
@@ -566,6 +568,13 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f
va += m68k_round_page(MSGBUFSIZE);
virtual_avail = va;
}
+
+ /*
+ * waste some kva before IOBase, in favor of simpilicity.
+ */
+
+ KASSERT(virtual_avail <= (vaddr_t)IOBase);
+ virtual_avail = (vaddr_t)Sysmap + M68K_MAX_PTSIZE;
}
void
@@ -639,18 +648,3 @@ bootstrap_mac68k(int tc)
videoaddr = newvideoaddr;
}
-
-void
-pmap_init_md(void)
-{
- vaddr_t addr;
-
- addr = (vaddr_t)IOBase;
- if (uvm_map(kernel_map, &addr,
- m68k_ptob(IIOMAPSIZE + ROMMAPSIZE + VIDMAPSIZE),
- NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
- UVM_INH_NONE, UVM_ADV_RANDOM,
- UVM_FLAG_FIXED)) != 0)
- panic("pmap_init_md: uvm_map failed");
-}
Index: m68k/include/pmap_motorola.h
===================================================================
RCS file: /cvsroot/src/sys/arch/m68k/include/pmap_motorola.h,v
retrieving revision 1.6
diff -u -p -r1.6 pmap_motorola.h
--- m68k/include/pmap_motorola.h 17 Jan 2005 04:37:20 -0000 1.6
+++ m68k/include/pmap_motorola.h 19 Feb 2005 03:23:46 -0000
@@ -183,7 +183,6 @@ pmap_remove_all(struct pmap *pmap)
extern pt_entry_t *Sysmap;
extern char *vmmap; /* map for mem, dumps, etc. */
-void pmap_init_md(void);
vaddr_t pmap_map(vaddr_t, paddr_t, paddr_t, int);
void pmap_procwr(struct proc *, vaddr_t, size_t);
#define PMAP_NEED_PROCWR
Index: m68k/m68k/pmap_motorola.c
===================================================================
RCS file: /cvsroot/src/sys/arch/m68k/m68k/pmap_motorola.c,v
retrieving revision 1.12.4.3
diff -u -p -r1.12.4.3 pmap_motorola.c
--- m68k/m68k/pmap_motorola.c 18 Feb 2005 14:38:29 -0000 1.12.4.3
+++ m68k/m68k/pmap_motorola.c 19 Feb 2005 03:23:47 -0000
@@ -374,27 +374,6 @@ pmap_init()
caddr1_pte = pmap_pte(pmap_kernel(), CADDR1);
caddr2_pte = pmap_pte(pmap_kernel(), CADDR2);
- /*
- * Now that kernel map has been allocated, we can mark as
- * unavailable regions which we have mapped in pmap_bootstrap().
- */
-
- pmap_init_md();
- addr = (vaddr_t) Sysmap;
- if (uvm_map(kernel_map, &addr, M68K_MAX_PTSIZE,
- NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
- UVM_INH_NONE, UVM_ADV_RANDOM,
- UVM_FLAG_FIXED)) != 0) {
- /*
- * If this fails, it is probably because the static
- * portion of the kernel page table isn't big enough
- * and we overran the page table map.
- */
-
- panic("pmap_init: bogons in the VM system!");
- }
-
PMAP_DPRINTF(PDB_INIT,
("pmap_init: Sysseg %p, Sysmap %p, Sysptmap %p\n",
Sysseg, Sysmap, Sysptmap));
--NextPart-20050219124519-0661200--