[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 03/18] xen: carve out grant tab initialization into dedicated
From: |
Juergen Gross |
Subject: |
[PATCH v3 03/18] xen: carve out grant tab initialization into dedicated function |
Date: |
Wed, 24 Oct 2018 16:54:12 +0200 |
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 v3 00/18] xen: add pvh guest support, Juergen Gross, 2018/10/24
- [PATCH v3 05/18] xen: add some dummy headers for PVH mode, Juergen Gross, 2018/10/24
- [PATCH v3 04/18] xen: prepare common code for Xen PVH support, Juergen Gross, 2018/10/24
- [PATCH v3 03/18] xen: carve out grant tab initialization into dedicated function,
Juergen Gross <=
- [PATCH v3 07/18] xen: add PVH specific defines to offset.h, Juergen Gross, 2018/10/24
- [PATCH v3 10/18] xen: setup hypercall page for PVH, Juergen Gross, 2018/10/24
- [PATCH v3 06/18] xen: rearrange xen/init.c to prepare it for Xen PVH mode, Juergen Gross, 2018/10/24
- [PATCH v3 08/18] xen: add basic hooks for PVH in current code, Juergen Gross, 2018/10/24
- [PATCH v3 02/18] loader/linux: support passing rsdp address via boot params, Juergen Gross, 2018/10/24
- [PATCH v3 15/18] grub-module-verifier: Ignore all_video for xenpvh, Juergen Gross, 2018/10/24
- [PATCH v3 11/18] xen: get memory map from hypervisor for PVH, Juergen Gross, 2018/10/24
- [PATCH v3 17/18] xen_pvh: support grub-install for xen_pvh, Juergen Gross, 2018/10/24
- [PATCH v3 14/18] xen_pvh: add build runes for grub-core, Juergen Gross, 2018/10/24
- [PATCH v3 13/18] xen: init memory regions for PVH, Juergen Gross, 2018/10/24