Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Xen doens't need lapic so don't allocate a lapic VA...



details:   https://anonhg.NetBSD.org/src/rev/8069ee1b9370
branches:  trunk
changeset: 819910:8069ee1b9370
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Dec 22 16:29:05 2016 +0000

description:
Xen doens't need lapic so don't allocate a lapic VA/PA for Xen.
As a side effect this makes XEN3PAE boot again but I don't know why ...

diffstat:

 sys/arch/amd64/amd64/machdep.c |   8 +++++---
 sys/arch/i386/i386/machdep.c   |   8 +++++---
 sys/arch/x86/x86/pmap.c        |  12 ++++++++----
 3 files changed, 18 insertions(+), 10 deletions(-)

diffs (158 lines):

diff -r baa116217579 -r 8069ee1b9370 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Thu Dec 22 16:05:14 2016 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Thu Dec 22 16:29:05 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.241 2016/12/22 14:47:54 cherry Exp $     */
+/*     $NetBSD: machdep.c,v 1.242 2016/12/22 16:29:05 bouyer Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.241 2016/12/22 14:47:54 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.242 2016/12/22 16:29:05 bouyer Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1543,11 +1543,11 @@
 init_x86_64(paddr_t first_avail)
 {
        extern void consinit(void);
-       extern paddr_t local_apic_pa;
        struct region_descriptor region;
        struct mem_segment_descriptor *ldt_segp;
        int x;
 #ifndef XEN
+       extern paddr_t local_apic_pa;
        int ist;
 #endif
 
@@ -1640,10 +1640,12 @@
 
        kpreempt_disable();
 
+#ifndef XEN
        pmap_kenter_pa(local_apic_va, local_apic_pa,
            VM_PROT_READ|VM_PROT_WRITE, 0);
        pmap_update(pmap_kernel());
        memset((void *)local_apic_va, 0, PAGE_SIZE);
+#endif
 
        pmap_kenter_pa(idt_vaddr, idt_paddr, VM_PROT_READ|VM_PROT_WRITE, 0);
        pmap_kenter_pa(gdt_vaddr, gdt_paddr, VM_PROT_READ|VM_PROT_WRITE, 0);
diff -r baa116217579 -r 8069ee1b9370 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Thu Dec 22 16:05:14 2016 +0000
+++ b/sys/arch/i386/i386/machdep.c      Thu Dec 22 16:29:05 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.771 2016/12/22 14:47:58 cherry Exp $     */
+/*     $NetBSD: machdep.c,v 1.772 2016/12/22 16:29:05 bouyer Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.771 2016/12/22 14:47:58 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.772 2016/12/22 16:29:05 bouyer Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -1137,9 +1137,9 @@
 init386(paddr_t first_avail)
 {
        extern void consinit(void);
-       extern paddr_t local_apic_pa;
        int x;
 #ifndef XEN
+       extern paddr_t local_apic_pa;
        union descriptor *tgdt;
        struct region_descriptor region;
 #endif
@@ -1305,10 +1305,12 @@
        cpu_info_primary.ci_pmap = pmap_kernel();
 #endif
 
+#ifndef XEN
        pmap_kenter_pa(local_apic_va, local_apic_pa,
            VM_PROT_READ|VM_PROT_WRITE, 0);
        pmap_update(pmap_kernel());
        memset((void *)local_apic_va, 0, PAGE_SIZE);
+#endif
 
        pmap_kenter_pa(idt_vaddr, idt_paddr, VM_PROT_READ|VM_PROT_WRITE, 0);
        pmap_kenter_pa(gdt_vaddr, gdt_paddr, VM_PROT_READ|VM_PROT_WRITE, 0);
diff -r baa116217579 -r 8069ee1b9370 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Thu Dec 22 16:05:14 2016 +0000
+++ b/sys/arch/x86/x86/pmap.c   Thu Dec 22 16:29:05 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.234 2016/12/20 14:03:15 maxv Exp $  */
+/*     $NetBSD: pmap.c,v 1.235 2016/12/22 16:29:05 bouyer Exp $        */
 
 /*-
  * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.234 2016/12/20 14:03:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.235 2016/12/22 16:29:05 bouyer Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -480,11 +480,13 @@
 static vaddr_t virtual_avail __read_mostly;    /* VA of first free KVA */
 static vaddr_t virtual_end __read_mostly;      /* VA of last free KVA */
 
+#ifndef XEN
 /*
  * LAPIC virtual address, and fake physical address.
  */
 volatile vaddr_t local_apic_va;
 paddr_t local_apic_pa;
+#endif
 
 /*
  * pool that pmap structures are allocated from
@@ -558,11 +560,11 @@
  * Local prototypes
  */
 
-static void pmap_init_lapic(void);
 #ifdef __HAVE_DIRECT_MAP
 static void pmap_init_directmap(struct pmap *);
 #endif
 #ifndef XEN
+static void pmap_init_lapic(void);
 static void pmap_remap_largepages(void);
 #endif
 
@@ -1327,9 +1329,9 @@
                /* Remap the kernel. */
                pmap_remap_largepages();
        }
+       pmap_init_lapic();
 #endif /* !XEN */
 
-       pmap_init_lapic();
 
 #ifdef __HAVE_DIRECT_MAP
        pmap_init_directmap(kpm);
@@ -1451,6 +1453,7 @@
        pmap_maxkvaddr = kva;
 }
 
+#ifndef XEN
 static void
 pmap_init_lapic(void)
 {
@@ -1466,6 +1469,7 @@
        local_apic_va = pmap_bootstrap_valloc(1);
        local_apic_pa = pmap_bootstrap_palloc(1);
 }
+#endif
 
 #ifdef __HAVE_DIRECT_MAP
 /*



Home | Main Index | Thread Index | Old Index