All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6.1 09/20] xen: add basic hooks for PVH in current code
@ 2018-12-07  7:35 Juergen Gross
  2018-12-07 11:50 ` Daniel Kiper
  2018-12-07 11:50 ` Daniel Kiper
  0 siblings, 2 replies; 6+ messages in thread
From: Juergen Gross @ 2018-12-07  7:35 UTC (permalink / raw)
  To: grub-devel; +Cc: xen-devel, phcoder, daniel.kiper, Juergen Gross

Add the hooks to current code needed for Xen PVH. They will be filled
with code later when the related functionality is being added.

loader/i386/linux.c needs to include machine/kernel.h now as it needs
to get GRUB_KERNEL_USE_RSDP_ADDR from there. This in turn requires to
add an empty kernel.h header for some i386 platforms (efi, coreboot,
ieee1275, xen).

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
V3: xenpvh->xen_pvh (Daniel Kiper)
    adjust copyright date (Roger Pau Monné)
V5: update commit message (Daniel Kiper)
    move including xen/hvm/start_info.h to the sources really needing
      it (Daniel Kiper)
V6.1: add empty kernel.h headers for i386 platforms
    It should be noted that i386_efi build is broken even without this
    patch, but this is clearly beyond the scope of this series.
---
 grub-core/Makefile.am                 |  5 +++++
 grub-core/kern/i386/xen/pvh.c         | 37 +++++++++++++++++++++++++++++++++++
 grub-core/kern/i386/xen/startup_pvh.S | 29 +++++++++++++++++++++++++++
 grub-core/kern/xen/init.c             |  4 ++++
 grub-core/loader/i386/linux.c         |  1 +
 include/grub/i386/coreboot/kernel.h   |  0
 include/grub/i386/ieee1275/kernel.h   |  0
 include/grub/i386/xen/kernel.h        |  0
 include/grub/i386/xen_pvh/kernel.h    | 30 ++++++++++++++++++++++++++++
 include/grub/xen.h                    |  5 +++++
 10 files changed, 111 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/coreboot/kernel.h
 create mode 100644 include/grub/i386/ieee1275/kernel.h
 create mode 100644 include/grub/i386/xen/kernel.h
 create mode 100644 include/grub/i386/xen_pvh/kernel.h

diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index f4ff62b76..89433f498 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -102,6 +102,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 endif
 
 if COND_i386_efi
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
@@ -111,6 +112,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
 endif
 
 if COND_i386_coreboot
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/coreboot/lbio.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
@@ -122,6 +124,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
 endif
 
 if COND_i386_multiboot
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
 endif
@@ -132,6 +135,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 endif
 
 if COND_i386_ieee1275
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
@@ -140,6 +144,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 endif
 
 if COND_i386_xen
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.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..4f629b15e
--- /dev/null
+++ b/grub-core/kern/i386/xen/pvh.c
@@ -0,0 +1,37 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2018  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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/kernel.h>
+#include <grub/misc.h>
+#include <grub/memory.h>
+#include <grub/mm.h>
+#include <grub/xen.h>
+#include <xen/hvm/start_info.h>
+#include <grub/machine/kernel.h>
+
+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..69b8fdcca
--- /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) 2018  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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+
+	.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 a23dad633..782ca7295 100644
--- a/grub-core/kern/xen/init.c
+++ b/grub-core/kern/xen/init.c
@@ -564,6 +564,10 @@ grub_machine_init (void)
 			   + GRUB_KERNEL_MACHINE_MOD_GAP,
 			   GRUB_KERNEL_MACHINE_MOD_ALIGN);
 
+#ifdef GRUB_MACHINE_XEN_PVH
+  grub_xen_setup_pvh ();
+#endif
+
   grub_xen_setup_gnttab ();
 
 #ifdef GRUB_MACHINE_XEN
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 375ee80dc..b6015913b 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -35,6 +35,7 @@
 #include <grub/i18n.h>
 #include <grub/lib/cmdline.h>
 #include <grub/linux.h>
+#include <grub/machine/kernel.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
diff --git a/include/grub/i386/coreboot/kernel.h b/include/grub/i386/coreboot/kernel.h
new file mode 100644
index 000000000..e69de29bb
diff --git a/include/grub/i386/ieee1275/kernel.h b/include/grub/i386/ieee1275/kernel.h
new file mode 100644
index 000000000..e69de29bb
diff --git a/include/grub/i386/xen/kernel.h b/include/grub/i386/xen/kernel.h
new file mode 100644
index 000000000..e69de29bb
diff --git a/include/grub/i386/xen_pvh/kernel.h b/include/grub/i386/xen_pvh/kernel.h
new file mode 100644
index 000000000..2b7b8a129
--- /dev/null
+++ b/include/grub/i386/xen_pvh/kernel.h
@@ -0,0 +1,30 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2018  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 <http://www.gnu.org/licenses/>.
+ */
+
+#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..91cb7cf81 100644
--- a/include/grub/xen.h
+++ b/include/grub/xen.h
@@ -95,6 +95,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_XEN_PVH
+extern struct hvm_start_info *pvh_start_info;
+void grub_xen_setup_pvh (void);
+#endif
 #endif
 
 #endif
-- 
2.16.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v6.1 09/20] xen: add basic hooks for PVH in current code
  2018-12-07  7:35 [PATCH v6.1 09/20] xen: add basic hooks for PVH in current code Juergen Gross
  2018-12-07 11:50 ` Daniel Kiper
@ 2018-12-07 11:50 ` Daniel Kiper
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Kiper @ 2018-12-07 11:50 UTC (permalink / raw)
  To: Juergen Gross; +Cc: grub-devel, phcoder, xen-devel

On Fri, Dec 07, 2018 at 08:35:26AM +0100, Juergen Gross wrote:
> Add the hooks to current code needed for Xen PVH. They will be filled
> with code later when the related functionality is being added.
>
> loader/i386/linux.c needs to include machine/kernel.h now as it needs
> to get GRUB_KERNEL_USE_RSDP_ADDR from there. This in turn requires to
> add an empty kernel.h header for some i386 platforms (efi, coreboot,
> ieee1275, xen).
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
> V3: xenpvh->xen_pvh (Daniel Kiper)
>     adjust copyright date (Roger Pau Monné)
> V5: update commit message (Daniel Kiper)
>     move including xen/hvm/start_info.h to the sources really needing
>       it (Daniel Kiper)
> V6.1: add empty kernel.h headers for i386 platforms

After this patch "xen_pvh: add build runes for grub-core" does not apply
any longer. May I ask you to rebase whole patch series on latest master
and resend it as v7?

>     It should be noted that i386_efi build is broken even without this
>     patch, but this is clearly beyond the scope of this series.

Could you tell me how exactly building fails?

Have you tested x86_64 efi and xen builds?

Daniel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v6.1 09/20] xen: add basic hooks for PVH in current code
  2018-12-07  7:35 [PATCH v6.1 09/20] xen: add basic hooks for PVH in current code Juergen Gross
@ 2018-12-07 11:50 ` Daniel Kiper
  2018-12-07 12:11     ` Juergen Gross
  2018-12-07 11:50 ` Daniel Kiper
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Kiper @ 2018-12-07 11:50 UTC (permalink / raw)
  To: Juergen Gross; +Cc: grub-devel, xen-devel, phcoder

On Fri, Dec 07, 2018 at 08:35:26AM +0100, Juergen Gross wrote:
> Add the hooks to current code needed for Xen PVH. They will be filled
> with code later when the related functionality is being added.
>
> loader/i386/linux.c needs to include machine/kernel.h now as it needs
> to get GRUB_KERNEL_USE_RSDP_ADDR from there. This in turn requires to
> add an empty kernel.h header for some i386 platforms (efi, coreboot,
> ieee1275, xen).
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
> V3: xenpvh->xen_pvh (Daniel Kiper)
>     adjust copyright date (Roger Pau Monné)
> V5: update commit message (Daniel Kiper)
>     move including xen/hvm/start_info.h to the sources really needing
>       it (Daniel Kiper)
> V6.1: add empty kernel.h headers for i386 platforms

After this patch "xen_pvh: add build runes for grub-core" does not apply
any longer. May I ask you to rebase whole patch series on latest master
and resend it as v7?

>     It should be noted that i386_efi build is broken even without this
>     patch, but this is clearly beyond the scope of this series.

Could you tell me how exactly building fails?

Have you tested x86_64 efi and xen builds?

Daniel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v6.1 09/20] xen: add basic hooks for PVH in current code
  2018-12-07 11:50 ` Daniel Kiper
@ 2018-12-07 12:11     ` Juergen Gross
  0 siblings, 0 replies; 6+ messages in thread
From: Juergen Gross @ 2018-12-07 12:11 UTC (permalink / raw)
  To: Daniel Kiper; +Cc: grub-devel, phcoder, xen-devel

On 07/12/2018 12:50, Daniel Kiper wrote:
> On Fri, Dec 07, 2018 at 08:35:26AM +0100, Juergen Gross wrote:
>> Add the hooks to current code needed for Xen PVH. They will be filled
>> with code later when the related functionality is being added.
>>
>> loader/i386/linux.c needs to include machine/kernel.h now as it needs
>> to get GRUB_KERNEL_USE_RSDP_ADDR from there. This in turn requires to
>> add an empty kernel.h header for some i386 platforms (efi, coreboot,
>> ieee1275, xen).
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
>> ---
>> V3: xenpvh->xen_pvh (Daniel Kiper)
>>     adjust copyright date (Roger Pau Monné)
>> V5: update commit message (Daniel Kiper)
>>     move including xen/hvm/start_info.h to the sources really needing
>>       it (Daniel Kiper)
>> V6.1: add empty kernel.h headers for i386 platforms
> 
> After this patch "xen_pvh: add build runes for grub-core" does not apply
> any longer. May I ask you to rebase whole patch series on latest master
> and resend it as v7?

Okay.

> 
>>     It should be noted that i386_efi build is broken even without this
>>     patch, but this is clearly beyond the scope of this series.
> 
> Could you tell me how exactly building fails?

No. It doesn't now. I head to do a "git clean" in order to be able to
rebase my patches on the most actual master. Seems as if there was some
stale file in my tree causing the build to fail.

> Have you tested x86_64 efi and xen builds?

x86_64 efi needs the header, too. Will be in V7.

Xen builds are working (now, with your fixup patches in place).


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v6.1 09/20] xen: add basic hooks for PVH in current code
@ 2018-12-07 12:11     ` Juergen Gross
  0 siblings, 0 replies; 6+ messages in thread
From: Juergen Gross @ 2018-12-07 12:11 UTC (permalink / raw)
  To: Daniel Kiper; +Cc: grub-devel, xen-devel, phcoder

On 07/12/2018 12:50, Daniel Kiper wrote:
> On Fri, Dec 07, 2018 at 08:35:26AM +0100, Juergen Gross wrote:
>> Add the hooks to current code needed for Xen PVH. They will be filled
>> with code later when the related functionality is being added.
>>
>> loader/i386/linux.c needs to include machine/kernel.h now as it needs
>> to get GRUB_KERNEL_USE_RSDP_ADDR from there. This in turn requires to
>> add an empty kernel.h header for some i386 platforms (efi, coreboot,
>> ieee1275, xen).
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
>> ---
>> V3: xenpvh->xen_pvh (Daniel Kiper)
>>     adjust copyright date (Roger Pau Monné)
>> V5: update commit message (Daniel Kiper)
>>     move including xen/hvm/start_info.h to the sources really needing
>>       it (Daniel Kiper)
>> V6.1: add empty kernel.h headers for i386 platforms
> 
> After this patch "xen_pvh: add build runes for grub-core" does not apply
> any longer. May I ask you to rebase whole patch series on latest master
> and resend it as v7?

Okay.

> 
>>     It should be noted that i386_efi build is broken even without this
>>     patch, but this is clearly beyond the scope of this series.
> 
> Could you tell me how exactly building fails?

No. It doesn't now. I head to do a "git clean" in order to be able to
rebase my patches on the most actual master. Seems as if there was some
stale file in my tree causing the build to fail.

> Have you tested x86_64 efi and xen builds?

x86_64 efi needs the header, too. Will be in V7.

Xen builds are working (now, with your fixup patches in place).


Juergen


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v6.1 09/20] xen: add basic hooks for PVH in current code
@ 2018-12-07  7:35 Juergen Gross
  0 siblings, 0 replies; 6+ messages in thread
From: Juergen Gross @ 2018-12-07  7:35 UTC (permalink / raw)
  To: grub-devel; +Cc: Juergen Gross, phcoder, daniel.kiper, xen-devel

Add the hooks to current code needed for Xen PVH. They will be filled
with code later when the related functionality is being added.

loader/i386/linux.c needs to include machine/kernel.h now as it needs
to get GRUB_KERNEL_USE_RSDP_ADDR from there. This in turn requires to
add an empty kernel.h header for some i386 platforms (efi, coreboot,
ieee1275, xen).

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
V3: xenpvh->xen_pvh (Daniel Kiper)
    adjust copyright date (Roger Pau Monné)
V5: update commit message (Daniel Kiper)
    move including xen/hvm/start_info.h to the sources really needing
      it (Daniel Kiper)
V6.1: add empty kernel.h headers for i386 platforms
    It should be noted that i386_efi build is broken even without this
    patch, but this is clearly beyond the scope of this series.
---
 grub-core/Makefile.am                 |  5 +++++
 grub-core/kern/i386/xen/pvh.c         | 37 +++++++++++++++++++++++++++++++++++
 grub-core/kern/i386/xen/startup_pvh.S | 29 +++++++++++++++++++++++++++
 grub-core/kern/xen/init.c             |  4 ++++
 grub-core/loader/i386/linux.c         |  1 +
 include/grub/i386/coreboot/kernel.h   |  0
 include/grub/i386/ieee1275/kernel.h   |  0
 include/grub/i386/xen/kernel.h        |  0
 include/grub/i386/xen_pvh/kernel.h    | 30 ++++++++++++++++++++++++++++
 include/grub/xen.h                    |  5 +++++
 10 files changed, 111 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/coreboot/kernel.h
 create mode 100644 include/grub/i386/ieee1275/kernel.h
 create mode 100644 include/grub/i386/xen/kernel.h
 create mode 100644 include/grub/i386/xen_pvh/kernel.h

diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index f4ff62b76..89433f498 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -102,6 +102,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 endif
 
 if COND_i386_efi
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
@@ -111,6 +112,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
 endif
 
 if COND_i386_coreboot
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/coreboot/lbio.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
@@ -122,6 +124,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
 endif
 
 if COND_i386_multiboot
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
 endif
@@ -132,6 +135,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 endif
 
 if COND_i386_ieee1275
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
@@ -140,6 +144,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
 endif
 
 if COND_i386_xen
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.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..4f629b15e
--- /dev/null
+++ b/grub-core/kern/i386/xen/pvh.c
@@ -0,0 +1,37 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2018  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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/kernel.h>
+#include <grub/misc.h>
+#include <grub/memory.h>
+#include <grub/mm.h>
+#include <grub/xen.h>
+#include <xen/hvm/start_info.h>
+#include <grub/machine/kernel.h>
+
+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..69b8fdcca
--- /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) 2018  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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+
+	.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 a23dad633..782ca7295 100644
--- a/grub-core/kern/xen/init.c
+++ b/grub-core/kern/xen/init.c
@@ -564,6 +564,10 @@ grub_machine_init (void)
 			   + GRUB_KERNEL_MACHINE_MOD_GAP,
 			   GRUB_KERNEL_MACHINE_MOD_ALIGN);
 
+#ifdef GRUB_MACHINE_XEN_PVH
+  grub_xen_setup_pvh ();
+#endif
+
   grub_xen_setup_gnttab ();
 
 #ifdef GRUB_MACHINE_XEN
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 375ee80dc..b6015913b 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -35,6 +35,7 @@
 #include <grub/i18n.h>
 #include <grub/lib/cmdline.h>
 #include <grub/linux.h>
+#include <grub/machine/kernel.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
diff --git a/include/grub/i386/coreboot/kernel.h b/include/grub/i386/coreboot/kernel.h
new file mode 100644
index 000000000..e69de29bb
diff --git a/include/grub/i386/ieee1275/kernel.h b/include/grub/i386/ieee1275/kernel.h
new file mode 100644
index 000000000..e69de29bb
diff --git a/include/grub/i386/xen/kernel.h b/include/grub/i386/xen/kernel.h
new file mode 100644
index 000000000..e69de29bb
diff --git a/include/grub/i386/xen_pvh/kernel.h b/include/grub/i386/xen_pvh/kernel.h
new file mode 100644
index 000000000..2b7b8a129
--- /dev/null
+++ b/include/grub/i386/xen_pvh/kernel.h
@@ -0,0 +1,30 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2018  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 <http://www.gnu.org/licenses/>.
+ */
+
+#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..91cb7cf81 100644
--- a/include/grub/xen.h
+++ b/include/grub/xen.h
@@ -95,6 +95,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_XEN_PVH
+extern struct hvm_start_info *pvh_start_info;
+void grub_xen_setup_pvh (void);
+#endif
 #endif
 
 #endif
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-07 12:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-07  7:35 [PATCH v6.1 09/20] xen: add basic hooks for PVH in current code Juergen Gross
2018-12-07 11:50 ` Daniel Kiper
2018-12-07 12:11   ` Juergen Gross
2018-12-07 12:11     ` Juergen Gross
2018-12-07 11:50 ` Daniel Kiper
  -- strict thread matches above, loose matches on Subject: below --
2018-12-07  7:35 Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.