From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1g9pnb-0001OI-2p for mharc-grub-devel@gnu.org; Tue, 09 Oct 2018 07:03:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9pnX-0001Mq-2S for grub-devel@gnu.org; Tue, 09 Oct 2018 07:03:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9pnU-0005P9-3C for grub-devel@gnu.org; Tue, 09 Oct 2018 07:03:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:55292 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9pnT-0005Lq-Kt for grub-devel@gnu.org; Tue, 09 Oct 2018 07:03:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B0A76AFAA; Tue, 9 Oct 2018 11:03:21 +0000 (UTC) From: Juergen Gross To: grub-devel@gnu.org Cc: xen-devel@lists.xen.org, phcoder@gmail.com, daniel.kiper@oracle.com, hans@knorrie.org, Juergen Gross Subject: [PATCH v2 08/18] xen: add basic hooks for PVH in current code Date: Tue, 9 Oct 2018 13:03:07 +0200 Message-Id: <20181009110317.6022-9-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181009110317.6022-1-jgross@suse.com> References: <20181009110317.6022-1-jgross@suse.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 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: Tue, 09 Oct 2018 11:03:33 -0000 Add the hooks to current code needed for Xen PVH. Signed-off-by: Juergen Gross --- grub-core/kern/i386/xen/pvh.c | 36 +++++++++++++++++++++++++++++++++++ grub-core/kern/i386/xen/startup_pvh.S | 29 ++++++++++++++++++++++++++++ grub-core/kern/xen/init.c | 6 ++++++ include/grub/i386/xenpvh/kernel.h | 30 +++++++++++++++++++++++++++++ include/grub/xen.h | 6 ++++++ 5 files changed, 107 insertions(+) create mode 100644 grub-core/kern/i386/xen/pvh.c create mode 100644 grub-core/kern/i386/xen/startup_pvh.S create mode 100644 include/grub/i386/xenpvh/kernel.h diff --git a/grub-core/kern/i386/xen/pvh.c b/grub-core/kern/i386/xen/pvh.c new file mode 100644 index 000000000..182ef95f9 --- /dev/null +++ b/grub-core/kern/i386/xen/pvh.c @@ -0,0 +1,36 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2011 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include +#include + +grub_uint64_t grub_rsdp_addr; + +void +grub_xen_setup_pvh (void) +{ +} + +grub_err_t +grub_machine_mmap_iterate (grub_memory_hook_t hook, void *hook_data) +{ +} diff --git a/grub-core/kern/i386/xen/startup_pvh.S b/grub-core/kern/i386/xen/startup_pvh.S new file mode 100644 index 000000000..e18ee5b31 --- /dev/null +++ b/grub-core/kern/i386/xen/startup_pvh.S @@ -0,0 +1,29 @@ +/* startup.S - bootstrap GRUB itself */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include + + .file "startup_pvh.S" + .text + +/* Saved pointer to start info structure. */ + .globl pvh_start_info +pvh_start_info: + .long 0 diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c index 10007b411..be71eee90 100644 --- a/grub-core/kern/xen/init.c +++ b/grub-core/kern/xen/init.c @@ -45,6 +45,8 @@ grub_xen_ptr2mfn (void *ptr) grub_xen_mfn_t *mfn_list = (grub_xen_mfn_t *) grub_xen_start_page_addr->mfn_list; return mfn_list[(grub_addr_t) ptr >> GRUB_XEN_LOG_PAGE_SIZE]; +#else + return (grub_addr_t) ptr >> GRUB_XEN_LOG_PAGE_SIZE; #endif } @@ -562,6 +564,10 @@ grub_machine_init (void) + GRUB_KERNEL_MACHINE_MOD_GAP, GRUB_KERNEL_MACHINE_MOD_ALIGN); +#ifdef GRUB_MACHINE_XENPVH + grub_xen_setup_pvh (); +#endif + grub_xen_setup_gnttab (); #ifdef GRUB_MACHINE_XEN diff --git a/include/grub/i386/xenpvh/kernel.h b/include/grub/i386/xenpvh/kernel.h new file mode 100644 index 000000000..7d4775dc3 --- /dev/null +++ b/include/grub/i386/xenpvh/kernel.h @@ -0,0 +1,30 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_KERNEL_MACHINE_HEADER +#define GRUB_KERNEL_MACHINE_HEADER 1 + +#ifndef ASM_FILE + +#define GRUB_KERNEL_USE_RSDP_ADDR 1 + +extern grub_uint64_t EXPORT_VAR(grub_rsdp_addr); + +#endif /* ! ASM_FILE */ + +#endif /* GRUB_KERNEL_MACHINE_HEADER */ diff --git a/include/grub/xen.h b/include/grub/xen.h index c31cc10c7..86eb29a44 100644 --- a/include/grub/xen.h +++ b/include/grub/xen.h @@ -43,6 +43,7 @@ typedef grub_uint64_t uint64_t; #include #include +#include #include #include #include @@ -95,6 +96,11 @@ typedef grub_uint64_t grub_xen_mfn_t; typedef grub_uint32_t grub_xen_mfn_t; #endif typedef unsigned int grub_xen_evtchn_t; + +#ifdef GRUB_MACHINE_XENPVH +extern struct hvm_start_info *pvh_start_info; +void grub_xen_setup_pvh (void); +#endif #endif #endif -- 2.16.4