Received: from list by lists.gnu.org with archive (Exim 4.71) id 1emHgA-0003nt-Ma for mharc-grub-devel@gnu.org; Thu, 15 Feb 2018 06:26:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emHg7-0003mz-VP for grub-devel@gnu.org; Thu, 15 Feb 2018 06:26:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emHg4-0007pc-R9 for grub-devel@gnu.org; Thu, 15 Feb 2018 06:26:15 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:40374) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emHg4-0007pH-ID for grub-devel@gnu.org; Thu, 15 Feb 2018 06:26:12 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1FBM1lc064409; Thu, 15 Feb 2018 11:26:08 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-2017-10-26; bh=0PGy16KYOJ6vkalXqUCRWF1JC/a/PBwDkxGTEjI6iUo=; b=u+4N8aOcYfBFbOQI5FV/Nm1rMbOmsdHq8Vz4N6IO8qeGYmfgEb8lbdz3mriPBTLVkj8g swEHrZGoxjmy0yKydDa06fe7VvXJa5IwoBWQbc85s7OSiQ24cayDxc5y9nZHZN31kkTG 3r02kjyzDLaalYVpj1c3VXTxD2JXuuVKB/xwZkn/VKuu/59lfaQtIFVfyI3+Se8dsBvA jRo6akYyQW99FRSs1+P9i8XGFud5SbonBX6sDB6sO8+SPIWlLJJLGcwXELx5SGz3Itgl M1mliXNU2P9rIAUIGhZGa+UgtgeEvAMuS7a3xjqN6AzQcz8UbzJacKLgSjvaM1KfmGCQ 1A== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2g58nm051f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2018 11:26:08 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1FBQ6dh000508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Feb 2018 11:26:06 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1FBQ5qr006105; Thu, 15 Feb 2018 11:26:05 GMT Received: from olila.local.net-space.pl (/10.175.214.62) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 15 Feb 2018 03:26:04 -0800 Date: Thu, 15 Feb 2018 12:26:01 +0100 From: Daniel Kiper To: Juergen Gross Cc: grub-devel@gnu.org, xen-devel@lists.xen.org, phcoder@gmail.com Subject: Re: [PATCH 3/8] xen: carve out grant tab initialization into dedicated function Message-ID: <20180215112601.GV19041@olila.local.net-space.pl> References: <20171129134650.20102-1-jgross@suse.com> <20171129134650.20102-4-jgross@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171129134650.20102-4-jgross@suse.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8805 signatures=668671 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=921 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802150141 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 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: Thu, 15 Feb 2018 11:26:17 -0000 On Wed, Nov 29, 2017 at 02:46:45PM +0100, Juergen Gross wrote: > Initialize the grant tab in a dedicated function. This will enable > using it for PVH guests, too. > > Signed-off-by: Juergen Gross > --- > grub-core/kern/xen/init.c | 35 +++++++++++++++++++++-------------- > 1 file changed, 21 insertions(+), 14 deletions(-) > > diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c > index 0559c033c..29f5bc23d 100644 > --- a/grub-core/kern/xen/init.c > +++ b/grub-core/kern/xen/init.c > @@ -318,6 +318,25 @@ grub_xenstore_dir (const char *dir, > > unsigned long gntframe = 0; > > +static void > +grub_xen_setup_gnttab (void) > +{ > + struct gnttab_set_version gnttab_setver; > + struct gnttab_setup_table gnttab_setup; > + > + grub_memset (&gnttab_setver, 0, sizeof (gnttab_setver)); > + > + gnttab_setver.version = 1; > + grub_xen_grant_table_op (GNTTABOP_set_version, &gnttab_setver, 1); > + > + grub_memset (&gnttab_setup, 0, sizeof (gnttab_setup)); > + gnttab_setup.dom = DOMID_SELF; > + gnttab_setup.nr_frames = 1; > + gnttab_setup.frame_list.p = &gntframe; > + > + grub_xen_grant_table_op (GNTTABOP_setup_table, &gnttab_setup, 1); > +} > + > #define MAX_N_UNUSABLE_PAGES 4 > > static int > @@ -357,26 +376,12 @@ map_all_pages (void) > (grub_xen_mfn_t *) grub_xen_start_page_addr->mfn_list; > grub_uint64_t *pg = (grub_uint64_t *) window; > grub_uint64_t oldpgstart, oldpgend; > - struct gnttab_setup_table gnttab_setup; > - struct gnttab_set_version gnttab_setver; > grub_size_t n_unusable_pages = 0; > struct mmu_update m2p_updates[2 * MAX_N_UNUSABLE_PAGES]; > > if (total_pages > MAX_TOTAL_PAGES - 4) > total_pages = MAX_TOTAL_PAGES - 4; > > - grub_memset (&gnttab_setver, 0, sizeof (gnttab_setver)); > - > - gnttab_setver.version = 1; > - grub_xen_grant_table_op (GNTTABOP_set_version, &gnttab_setver, 1); > - > - grub_memset (&gnttab_setup, 0, sizeof (gnttab_setup)); > - gnttab_setup.dom = DOMID_SELF; > - gnttab_setup.nr_frames = 1; > - gnttab_setup.frame_list.p = &gntframe; > - > - grub_xen_grant_table_op (GNTTABOP_setup_table, &gnttab_setup, 1); > - > for (j = 0; j < total_pages - n_unusable_pages; j++) > while (!grub_xen_is_page_usable (mfn_list[j])) > { > @@ -537,6 +542,8 @@ grub_machine_init (void) > + GRUB_KERNEL_MACHINE_MOD_GAP, > GRUB_KERNEL_MACHINE_MOD_ALIGN); > > + grub_xen_setup_gnttab (); > + I am OK with this patch itself but I am not sure why you are moving grant setup from map_all_pages() to grub_machine_init(). Is it by mistake or by purpose? If by purpose please explain why in the commit message. Daniel