From patchwork Sat Jan 16 01:39:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 8048501 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E5B51BEEE5 for ; Sat, 16 Jan 2016 01:42:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 074E520295 for ; Sat, 16 Jan 2016 01:42:58 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 219D7202EC for ; Sat, 16 Jan 2016 01:42:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aKFq0-0000Nv-1y; Sat, 16 Jan 2016 01:39:32 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aKFpw-0000Nq-Ba for xen-devel@lists.xensource.com; Sat, 16 Jan 2016 01:39:29 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id 16/A0-14422-F4F99965; Sat, 16 Jan 2016 01:39:27 +0000 X-Env-Sender: mcgrof@gmail.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1452908365!15961405!1 X-Originating-IP: [209.85.160.173] X-SpamReason: No, hits=0.8 required=7.0 tests=BODY_RANDOM_LONG, RCVD_BY_IP X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15756 invoked from network); 16 Jan 2016 01:39:26 -0000 Received: from mail-yk0-f173.google.com (HELO mail-yk0-f173.google.com) (209.85.160.173) by server-7.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 16 Jan 2016 01:39:26 -0000 Received: by mail-yk0-f173.google.com with SMTP id v14so469047381ykd.3 for ; Fri, 15 Jan 2016 17:39:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=V1LzTxkf3Cgwsfz5sqpz1v/xYasP0aSDE2V75JZXzDs=; b=vKC1GbtWlI46mLMBVXz9sqlhCulWghBC0gWRy9j5toCa1NZl4lSr3u3m14mhQi+0Ht jq5s9x0ZiPbpYr8yjkxi/YzOYzZzHeitUgVnTCy1veBZU+R9B5FUh/7qMIKzmYJl0E+s k0eipHR95R7nrEbZrtTOKDjGjjF4T9zPoee74XRxgCdQgRYbQ4UbMrMj/h3bTrmfT2aq 2F4mneRqw8bJX5IrI65ZliLX4xHECWQzoJmXW5LmRLC6q1BXuX+N0ufbu8ZNer/24X32 iLURQJa0clOax4/fiugoQCY7ITPlG8A7yPAfPUHA/cs9jZMAdVDu4lj2BFq3WjGDibGx zZLw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=do-not-panic-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=V1LzTxkf3Cgwsfz5sqpz1v/xYasP0aSDE2V75JZXzDs=; b=QVQPgF+u15/PGMtbj0L0cfIwKCqXcdW4AoHIZbc0yvqGACgG4oGfACToLylLMb3Unz sPx1e5iP6tb3yakTRLU0aT3+bUk1rs+V1nJWsZPsmzj7hDl2bMr6gOY8sN3tno+4aYlq tYAZ2zRy/bPZpaKAGfEFfWJkfzdv6XyH2FT2pDGsQL7opmIkefPkhvHcSbkJ4l4RQ7v8 ztho0Aj11KvjorUHo1hTTpFqk79N2oYsJlFWm0K3woNAitlMQB/DFfY4F2NlDHLjgG54 YWf/+9TlcsRv0KR+f/Y1WSQvoe5GsxOg3QCmPXstphYsxr62qW8zwkLLTHoDA23vwrgg vo9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=V1LzTxkf3Cgwsfz5sqpz1v/xYasP0aSDE2V75JZXzDs=; b=JyC8pKaDAdpFgFfsNbSl2IYytIYYFlhr1jpJ2rHeMqQI0JPUYCMzmNABF8alRTVl4w QyqLj1pqnojp3cXGuvgFCDLFQhZ5/EkdLm/xl0LiBRtkMnECcX8I5tkx6kVqRYFBX7Bo HrO3x9+iX/b09NUVPB3Yk82O6Y/ZpklA8OUSndiy5kY5wAfh9kTBNLs6MWaJMRz5etfi 9Fs9MgRxdFXbwCxEYx74P2MKxb+w3J/6KANmSrZjO/AlZqSTL0ya3DsFpfv1bOi8azMU L6grhbvOUAL0S+cGj8IZU+NV74koagGLJTiM1Zbd1FPs3TFZ0lqrvaAluAMSpOaZJhst xnTw== X-Gm-Message-State: ALoCoQkAUlQQy8IgdHkaDNbx9ClyG0XqFfb9nsOQs1XHZDU8361Rlrl+amfyrx0fWtnbUn2vnCBrpJ+kUqiuqePwaJsJb0p5Kg== X-Received: by 10.129.9.214 with SMTP id 205mr9480257ywj.53.1452908365183; Fri, 15 Jan 2016 17:39:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.13.215.10 with HTTP; Fri, 15 Jan 2016 17:39:05 -0800 (PST) In-Reply-To: <20160116004304.GS11277@wotan.suse.de> References: <20160116004304.GS11277@wotan.suse.de> From: "Luis R. Rodriguez" Date: Fri, 15 Jan 2016 17:39:05 -0800 X-Google-Sender-Auth: ZUF1Lkl1sf-g2u7qP-sBr_MHBUA Message-ID: To: Andy Lutomirski Cc: Juergen Gross , Jeremy Fitzhardinge , Rusty Russell , X86 ML , "linux-kernel@vger.kernel.org" , "xen-devel@lists.xensource.com" , "H. Peter Anvin" , "Luis R. Rodriguez" , Borislav Petkov Subject: Re: [Xen-devel] Unifying x86_64 / Xen init paths and reading hardware_subarch early X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jan 15, 2016 at 4:43 PM, Luis R. Rodriguez 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. Luis 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