From owner-p4-projects@FreeBSD.ORG Wed Feb 1 23:40:38 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4714216A423; Wed, 1 Feb 2006 23:40:38 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0DA6416A422 for ; Wed, 1 Feb 2006 23:40:38 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C91243DC4 for ; Wed, 1 Feb 2006 23:40:09 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k11Ne6Oo011368 for ; Wed, 1 Feb 2006 23:40:06 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k11Ne61m011365 for perforce@freebsd.org; Wed, 1 Feb 2006 23:40:06 GMT (envelope-from kmacy@freebsd.org) Date: Wed, 1 Feb 2006 23:40:06 GMT Message-Id: <200602012340.k11Ne61m011365@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 90907 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2006 23:40:39 -0000 http://perforce.freebsd.org/chv.cgi?CH=90907 Change 90907 by kmacy@kmacy:freebsd7_xen3 on 2006/02/01 23:39:38 it turns out that doing the ISA hole shifting at the P2M interface would require too many changes to pmap.c this change shifts all the P2M mappings up by 4MB at init time when ADD_ISA_HOLE is set - this effectively throws away the upper 4MB of machine addresses that we are given Affected files ... .. //depot/projects/xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#9 edit .. //depot/projects/xen3/src/sys/i386-xen/include/xenvar.h#6 edit Differences ... ==== //depot/projects/xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#9 (text+ko) ==== @@ -554,6 +554,36 @@ static vm_offset_t *pdir_shadow; +#ifdef ADD_ISA_HOLE +static void +shift_phys_machine(unsigned long *phys_machine, int nr_pages) +{ + unsigned long *tmp_page, *current_page, *next_page; + int i; + + tmp_page = bootmem_alloc(PAGE_SIZE); + current_page = phys_machine; + next_page = phys_machine + (PAGE_SIZE/sizeof(unsigned long)); + bcopy(current_page, tmp_page, PAGE_SIZE); + + for (i = 0; i < (nr_pages - 1024); i++) { + xen_machphys_update(phys_machine[i], i + 1024); + } + while (next_page < (phys_machine + nr_pages)) { + bcopy(tmp_page, current_page, PAGE_SIZE); + bcopy(next_page, tmp_page, PAGE_SIZE); + + current_page += (PAGE_SIZE/sizeof(unsigned long)); + next_page += (PAGE_SIZE/sizeof(unsigned long)); + } + bootmem_free(tmp_page, PAGE_SIZE); + + + memset(phys_machine, INVALID_P2M_ENTRY, PAGE_SIZE); + +} +#endif + void initvalues(start_info_t *startinfo) { @@ -575,6 +605,15 @@ /* number of pages allocated after the pts + 1*/; unsigned long tmpindex = (VTOPFN(xen_start_info->pt_base) + xen_start_info->nr_pt_frames) + 3; xendebug_flags = 0xffffffff; + + /* allocate 4 pages for bootmem allocator */ + bootmem_start = bootmem_current = (char *)PFNTOV(tmpindex); + tmpindex += 4; + bootmem_end = (char *)PFNTOV(tmpindex); + +#ifdef ADD_ISA_HOLE + shift_phys_machine(xen_phys_machine, xen_start_info->nr_pages); +#endif /* * pre-zero unused mapped pages - mapped on 4MB boundary */ @@ -606,11 +645,6 @@ ldt = (union descriptor *)PFNTOV(tmpindex); tmpindex++; - /* allocate 4 pages for bootmem allocator */ - bootmem_start = bootmem_current = (char *)PFNTOV(tmpindex); - tmpindex += 4; - bootmem_end = (char *)PFNTOV(tmpindex); - /* initialize page directory shadow page */ pdir_shadow = (vm_offset_t *)PFNTOV(tmpindex); i686_pagezero(pdir_shadow); ==== //depot/projects/xen3/src/sys/i386-xen/include/xenvar.h#6 (text+ko) ==== @@ -28,8 +28,8 @@ #endif -#define PFNTOMFN(i) (((unsigned long *)xen_phys_machine)[(i) - ISA_INDEX_OFFSET]) -#define MFNTOPFN(i) (xen_machine_phys[i] + ISA_INDEX_OFFSET) +#define PFNTOMFN(i) (((unsigned long *)xen_phys_machine)[(i)]) +#define MFNTOPFN(i) (xen_machine_phys[i]) #define VTOP(x) ((unsigned long)(x) - KERNBASE) #define PTOV(x) ((unsigned long)(x) + KERNBASE)