summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/sparc64/machdep.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2009-06-28 22:42:51 +0000
committermarius <marius@FreeBSD.org>2009-06-28 22:42:51 +0000
commit54f24c117ae26fcfb1000a0fe7ab5f376997f7f6 (patch)
treeb971befb61e661c38ca8a12e087cc3b59f93ce95 /sys/sparc64/sparc64/machdep.c
parentc61e1d6988484a6875f72fcc81e34d5a1c2dccfa (diff)
downloadFreeBSD-src-54f24c117ae26fcfb1000a0fe7ab5f376997f7f6.zip
FreeBSD-src-54f24c117ae26fcfb1000a0fe7ab5f376997f7f6.tar.gz
- Work around the broken loader behavior of not demapping no longer
used kernel TLB slots when unloading the kernel or modules, which results in havoc when loading a kernel and modules which take up less TLB slots afterwards as the unused but locked ones aren't accounted for in virtual_avail. Eventually this should be fixed in the loader which isn't straight forward though and the kernel should be robust against this anyway. [1] - Ensure that the addresses allocated directly from phys_avail[] by pmap_bootstrap_alloc() are always colored properly. This implicit assumption was broken in r194784 as unlike the other consumers the DPCPU area allocated for the BSP isn't a multiple of PAGE_SIZE * DCACHE_COLORS. [2] - Remove the no longer used global msgbuf_phys. - Remove the redundant ekva parameter of pmap_bootstrap_alloc(). - Correct some outdated function names in ktr(9) invocations. Requested by: jhb [1] Reported by: gavin [2] Approved by: re (kib) MFC after: 2 weeks
Diffstat (limited to 'sys/sparc64/sparc64/machdep.c')
-rw-r--r--sys/sparc64/sparc64/machdep.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index b90a54d..49a2bb1 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -243,6 +243,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
char *env;
struct pcpu *pc;
vm_offset_t end;
+ vm_offset_t va;
caddr_t kmdp;
phandle_t child;
phandle_t root;
@@ -368,19 +369,28 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
* Panic if there is no metadata. Most likely the kernel was booted
* directly, instead of through loader(8).
*/
- if (mdp == NULL || kmdp == NULL) {
- printf("sparc64_init: no loader metadata.\n"
+ if (mdp == NULL || kmdp == NULL || end == 0 ||
+ kernel_tlb_slots == 0 || kernel_tlbs == NULL) {
+ printf("sparc64_init: missing loader metadata.\n"
"This probably means you are not using loader(8).\n");
panic("sparc64_init");
}
/*
- * Sanity check the kernel end, which is important.
+ * Work around the broken loader behavior of not demapping no
+ * longer used kernel TLB slots when unloading the kernel or
+ * modules.
*/
- if (end == 0) {
- printf("sparc64_init: warning, kernel end not specified.\n"
- "Attempting to continue anyway.\n");
- end = (vm_offset_t)_end;
+ for (va = KERNBASE + (kernel_tlb_slots - 1) * PAGE_SIZE_4M;
+ va >= roundup2(end, PAGE_SIZE_4M); va -= PAGE_SIZE_4M) {
+ printf("demapping unused kernel TLB slot (va %#lx - %#lx)\n",
+ va, va + PAGE_SIZE_4M - 1);
+ stxa(TLB_DEMAP_VA(va) | TLB_DEMAP_PRIMARY | TLB_DEMAP_PAGE,
+ ASI_DMMU_DEMAP, 0);
+ stxa(TLB_DEMAP_VA(va) | TLB_DEMAP_PRIMARY | TLB_DEMAP_PAGE,
+ ASI_IMMU_DEMAP, 0);
+ flush(KERNBASE);
+ kernel_tlb_slots--;
}
/*
@@ -429,7 +439,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
/*
* Initialize virtual memory and calculate physmem.
*/
- pmap_bootstrap(end);
+ pmap_bootstrap();
/*
* Initialize tunables.
@@ -752,6 +762,7 @@ cpu_shutdown(void *args)
void
cpu_flush_dcache(void *ptr, size_t len)
{
+
/* TBD */
}
OpenPOWER on IntegriCloud