All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Juergen Gross <jgross@suse.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>, Rusty Russell <rusty@rustcorp.com.au>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
	Borislav Petkov <bp@suse.de>
Subject: Re: Unifying x86_64 / Xen init paths and reading hardware_subarch early
Date: Fri, 15 Jan 2016 17:39:05 -0800	[thread overview]
Message-ID: <CAB=NE6XR2_waHnAfea+9tgWmkNQgjBBRXXDJdRzmz_=M17xZUA@mail.gmail.com> (raw)
In-Reply-To: <20160116004304.GS11277@wotan.suse.de>

On Fri, Jan 15, 2016 at 4:43 PM, Luis R. Rodriguez <mcgrof@suse.com> 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

  parent reply	other threads:[~2016-01-16  1:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 22:08 Unifying x86_64 / Xen init paths and reading hardware_subarch early Luis R. Rodriguez
2016-01-15 23:47 ` Andy Lutomirski
2016-01-16  0:43   ` Luis R. Rodriguez
2016-01-16  1:18     ` H. Peter Anvin
2016-01-16  1:39     ` Luis R. Rodriguez [this message]
2016-01-16  9:09       ` Borislav Petkov
2016-01-20 22:24   ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAB=NE6XR2_waHnAfea+9tgWmkNQgjBBRXXDJdRzmz_=M17xZUA@mail.gmail.com' \
    --to=mcgrof@do-not-panic.com \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=rusty@rustcorp.com.au \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.