[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Unifying x86_64 / Xen init paths and reading hardware_subarch early



On Fri, Jan 15, 2016 at 4:43 PM, Luis R. Rodriguez <mcgrof@xxxxxxxx> wrote:
>>     for (i = 0; i < sizeof(boot_params); i += 4096)
>>         early_make_pgtable((unsigned long)params + i);
>
>  I'll give this a shot.

Thanks again for this! It seems to let this boot now! But it does not
seem to provided the right value. If I use the qemu debug patch as I
listed before to set this to 5 for kvm, and boot it doesn't come up.
This can be tested with the qemu debug patch + this debug kernel patch
which prints it out and resets it from what it finds early.

If you comment out the boot_params.hdr.hardware_subarch =
my_hardware_subarch; assignment we get the right value from the
copy_bootdata() work. I use my_hardware_subarch just as a quick hack
to test and cache the value early code gets but that I can't print
early on.

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index c913b7eb5056..6fc92553f272 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -139,9 +139,12 @@ static void __init copy_bootdata(char *real_mode_data)
  }
 }

+__u32 my_hardware_subarch;
+
 asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
 {
  int i;
+ struct boot_params *params = (struct boot_params *)__va(real_mode_data);

  /*
  * Build-time sanity checks on the kernel image and module
@@ -157,6 +160,13 @@ asmlinkage __visible void __init
x86_64_start_kernel(char * real_mode_data)
  (__START_KERNEL & PGDIR_MASK)));
  BUILD_BUG_ON(__fix_to_virt(__end_of_fixed_addresses) <= MODULES_END);

+ /* Make the zero page accessible as early as possible */
+ for (i = 0; i < sizeof(boot_params); i += 4096)
+ early_make_pgtable((unsigned long)params + i);
+
+ boot_params.hdr.hardware_subarch = params->hdr.hardware_subarch;
+ my_hardware_subarch = params->hdr.hardware_subarch;
+
  cr4_init_shadow();

  /* Kill off the identity-map trampoline */
@@ -173,6 +183,7 @@ asmlinkage __visible void __init
x86_64_start_kernel(char * real_mode_data)
  load_idt((const struct desc_ptr *)&idt_descr);

  copy_bootdata(__va(real_mode_data));
+ boot_params.hdr.hardware_subarch = my_hardware_subarch;

  /*
  * Load microcode early on BSP.
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d3d80e6d42a2..c2f85f8ab52b 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -851,6 +851,8 @@ void __init setup_arch(char **cmdline_p)
  (unsigned long)__bss_stop - (unsigned long)_text);

  early_reserve_initrd();
+ pr_info("boot_params.hdr.hardware_subarch: 0x%04x\n",
+ boot_params.hdr.hardware_subarch);

  /*
  * At this point everything still needed from the boot loader


  Luis

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.