Re: [Xen-devel] [PATCH v4 02/19] loader/linux: support passing rsdp address via boot params

2018-11-07 Thread Daniel Kiper
On Fri, Nov 02, 2018 at 01:37:21PM +0100, Juergen Gross wrote:
> Xen PVH guests will have the RSDP at an arbitrary address. Support that
> by passing the RSDP address via the boot parameters to Linux.
>
> The new protocol version 2.14 requires to set version to 0x8000 ored
> with the actually use protocol version (the minimum of the kernel
> supplied protocol version and the grub2 supported protocol version)
> if 2.14 or higher are in effect.
>
> Signed-off-by: Juergen Gross 

Reviewed-by: Daniel Kiper 

Daniel

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

[Xen-devel] [PATCH v4 02/19] loader/linux: support passing rsdp address via boot params

2018-11-02 Thread Juergen Gross
Xen PVH guests will have the RSDP at an arbitrary address. Support that
by passing the RSDP address via the boot parameters to Linux.

The new protocol version 2.14 requires to set version to 0x8000 ored
with the actually use protocol version (the minimum of the kernel
supplied protocol version and the grub2 supported protocol version)
if 2.14 or higher are in effect.

Signed-off-by: Juergen Gross 
---
V2: add oring 0x8000 to version field
V3: move including machine/kernel.h to patch 8 (Daniel Kiper)
---
 grub-core/loader/i386/linux.c | 8 
 include/grub/i386/linux.h | 5 -
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 4eab55a2d..51920896e 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -750,6 +750,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ 
((unused)),
   prot_init_space = page_align (prot_size) * 3;
 }
 
+#ifdef GRUB_KERNEL_USE_RSDP_ADDR
+  if (grub_le_to_cpu16 (lh.version) >= 0x020e)
+lh.acpi_rsdp_addr = grub_le_to_cpu64 (grub_rsdp_addr);
+#endif
+
+  if (grub_le_to_cpu16 (lh.version) >= 0x020e)
+lh.version = grub_le_to_cpu16 (LINUX_LOADER_VERSION_TAG | 0x020e);
+
   if (allocate_pages (prot_size, ,
  min_align, relocatable,
  preferred_address))
diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
index 60c7c3b5e..5cbcfbe5a 100644
--- a/include/grub/i386/linux.h
+++ b/include/grub/i386/linux.h
@@ -87,7 +87,7 @@ enum
 GRUB_VIDEO_LINUX_TYPE_SIMPLE = 0x70/* Linear framebuffer without any 
additional functions.  */
   };
 
-/* For the Linux/i386 boot protocol version 2.10.  */
+/* For the Linux/i386 boot protocol version 2.14.  */
 struct linux_i386_kernel_header
 {
   grub_uint8_t code1[0x0020];
@@ -105,6 +105,7 @@ struct linux_i386_kernel_header
   grub_uint16_t jump;  /* Jump instruction */
   grub_uint32_t header;/* Magic signature "HdrS" */
   grub_uint16_t version;   /* Boot protocol version supported */
+#define LINUX_LOADER_VERSION_TAG   0x8000
   grub_uint32_t realmode_swtch;/* Boot loader hook */
   grub_uint16_t start_sys; /* The load-low segment (obsolete) */
   grub_uint16_t kernel_version;/* Points to kernel version 
string */
@@ -142,6 +143,8 @@ struct linux_i386_kernel_header
   grub_uint64_t setup_data;
   grub_uint64_t pref_address;
   grub_uint32_t init_size;
+  grub_uint32_t handover_offset;
+  grub_uint64_t acpi_rsdp_addr;
 } GRUB_PACKED;
 
 /* Boot parameters for Linux based on 2.6.12. This is used by the setup
-- 
2.16.4


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