Received: from list by lists.gnu.org with archive (Exim 4.71) id 1gEYR8-0000Y8-ED for mharc-grub-devel@gnu.org; Mon, 22 Oct 2018 07:31:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEYR5-0000Xr-MX for grub-devel@gnu.org; Mon, 22 Oct 2018 07:31:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEYR2-0000Rc-5W for grub-devel@gnu.org; Mon, 22 Oct 2018 07:31:51 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:38474) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gEYR1-0000QZ-Q3 for grub-devel@gnu.org; Mon, 22 Oct 2018 07:31:48 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9MBIrDF143764; Mon, 22 Oct 2018 11:31:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=raXl5IHO3TyfyREOQ+lesNKiLNhif4/25NNGbWLwxBc=; b=v5rCoYnQLu1gKUqhuuosj1QXyEUkDQv3AiDsLFkDATW8K/T0mXLnv48jwHn5lOVU6QYH ybigs7emC4SR7nmo0GIg4fEqQf1l/95iCYFBLftUvsjng7sWets4t6YXaP2PE/3F+k2T HjIw5J8yZGTGSUFOxoJAkl5ziWXvq6bCVRBLe+T/hs38El323vfcL3yxt0ZFBonTeq9+ fRNZppi82vSWHBM5OPNPF3JOet6CbgUjXxZ5gIDMUqLHR7asJ4+ux19uj65BvAMiwHF/ NyOjRBI2M0eSW8VPENrp0pjHNFNPKDhiJMAqRUPgvMIBAW7CkewFmHISaLKivLDRfLFl 0g== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2n7vapnu4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Oct 2018 11:31:45 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9MBVia9019671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Oct 2018 11:31:44 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9MBVhCF005167; Mon, 22 Oct 2018 11:31:43 GMT Received: from olila.i.net-space.pl (/10.175.186.189) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Oct 2018 04:31:43 -0700 Date: Mon, 22 Oct 2018 13:31:39 +0200 From: Daniel Kiper To: Juergen Gross Cc: grub-devel@gnu.org, xen-devel@lists.xen.org, phcoder@gmail.com, hans@knorrie.org Subject: Re: [PATCH v2 13/18] xen: init memory regions for PVH Message-ID: <20181022113139.GC4548@olila.i.net-space.pl> References: <20181009110317.6022-1-jgross@suse.com> <20181009110317.6022-14-jgross@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181009110317.6022-14-jgross@suse.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9053 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=973 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810220101 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 141.146.126.78 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Oct 2018 11:31:53 -0000 On Tue, Oct 09, 2018 at 01:03:12PM +0200, Juergen Gross wrote: > Add all usable memory regions to grub memory management and add the > needed mmap iterate code. I am missing a few words why this patch is needed. Especially why grub_machine_mmap_iterate() has to belong to this patch. However, I think that it should be introduced by patch in which grub_machine_mmap_iterate() is used at some point. > As we are running in 32-bit mode don't add memory above 4GB. > > Signed-off-by: Juergen Gross > --- > grub-core/kern/i386/xen/pvh.c | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/grub-core/kern/i386/xen/pvh.c b/grub-core/kern/i386/xen/pvh.c > index 93ed68245..c4a8bccf4 100644 > --- a/grub-core/kern/i386/xen/pvh.c > +++ b/grub-core/kern/i386/xen/pvh.c > @@ -222,6 +222,30 @@ grub_xen_get_mmap (void) > grub_xen_sort_mmap (); > } > > +static void > +grub_xen_mm_init_regions (void) > +{ > + grub_uint64_t modend, from, to; > + unsigned int i; > + > + modend = grub_modules_get_end (); > + > + for (i = 0; i < nr_map_entries; i++) > + { > + if (map[i].type != GRUB_MEMORY_AVAILABLE) > + continue; > + from = map[i].addr; > + to = from + map[i].len; > + if (from < modend) > + from = modend; > + if (from >= to || from >= 0x100000000ULL) > + continue; > + if (to > 0x100000000ULL) > + to = 0x100000000ULL; > + grub_mm_init_region ((void *) (grub_addr_t) from, to - from); > + } > +} > + > static grub_uint64_t > grub_xen_find_page (grub_uint64_t start) > { > @@ -302,10 +326,21 @@ grub_xen_setup_pvh (void) > grub_xen_shared_info = grub_xen_add_physmap (XENMAPSPACE_shared_info, > (void *) par); > > + grub_xen_mm_init_regions (); > + > grub_rsdp_addr = pvh_start_info->rsdp_paddr; > } > > grub_err_t > grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data) > { > + unsigned int i; > + > + for (i = 0; i < nr_map_entries; i++) > + { > + if (map[i].len && hook (map[i].addr, map[i].len, map[i].type, hook_data)) > + break; > + } > + > + return GRUB_ERR_NONE; Daniel