[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 03/20] xen: carve out grant tab initialization into dedicated
From: |
Juergen Gross |
Subject: |
[PATCH v6 03/20] xen: carve out grant tab initialization into dedicated function |
Date: |
Wed, 28 Nov 2018 14:55:13 +0100 |
Initialize the grant tab in a dedicated function. This will enable
using it for PVH guests, too.
Call the new function from grub_machine_init() as this will later
be common between Xen PV and Xen PVH mode.
Signed-off-by: Juergen Gross <address@hidden>
Reviewed-by: Daniel Kiper <address@hidden>
---
V2: update commit message (Daniel Kiper)
---
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 ();
+
map_all_pages ();
grub_console_init ();
--
2.16.4
- [PATCH v6 00/20] xen: add pvh guest support, Juergen Gross, 2018/11/28
- [PATCH v6 02/20] loader/linux: support passing rsdp address via boot params, Juergen Gross, 2018/11/28
- [PATCH v6 10/20] xen: add PVH boot entry code, Juergen Gross, 2018/11/28
- [PATCH v6 04/20] xen: prepare common code for Xen PVH support, Juergen Gross, 2018/11/28
- [PATCH v6 03/20] xen: carve out grant tab initialization into dedicated function,
Juergen Gross <=
- [PATCH v6 08/20] xen: add PVH specific defines to offset.h, Juergen Gross, 2018/11/28
- [PATCH v6 13/20] xen: setup Xen specific data for PVH, Juergen Gross, 2018/11/28
- [PATCH v6 11/20] xen: setup hypercall page for PVH, Juergen Gross, 2018/11/28
- [PATCH v6 05/20] xen: add some dummy headers for PVH mode, Juergen Gross, 2018/11/28
- [PATCH v6 12/20] xen: get memory map from hypervisor for PVH, Juergen Gross, 2018/11/28
- [PATCH v6 07/20] xen: modify grub_xen_ptr2mfn() for xen-pvh, Juergen Gross, 2018/11/28
- [PATCH v6 19/20] xen_pvh: support grub-install for xen_pvh, Juergen Gross, 2018/11/28
- [PATCH v6 16/20] grub-module-verifier: Ignore all_video for xenpvh, Juergen Gross, 2018/11/28