Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1118349imu; Wed, 16 Jan 2019 13:05:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN6gq93bcI0QoFpbEEPuYgMNbf5aCwpBWWbp3vN081VUOd9JbGsiqbrWdZ3BSDzdpzfDZu9P X-Received: by 2002:a63:e74b:: with SMTP id j11mr10734229pgk.397.1547672750583; Wed, 16 Jan 2019 13:05:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547672750; cv=none; d=google.com; s=arc-20160816; b=TkX1UiaeM2hicffyGMTmaVXDPXxbDSTmtYDswGre5UA5BlAwbVWUTV32XAjsL6L5DQ MZ7qWlJqTzDjQkoakMsq2WKdkEKBm4MZThjy+VXuR9BkY8ex5OT0CU+BPqSsj380brA6 62O64ODOVj5VOvN7j8E+bHfGtWr1xto8bL0ZAiVtFtdcm3yYcgAIrNxDYeZkhbpFGjjp DdE8Kp5Kh1nydPjzWNv16fy5A2jw8rRUEqPvIpLx1hW11+vmOYarzH83vsUN4at1O7fn V8ksN1RpEltDZCHTPI4iyA2YOQVRBOmy+GptvViQm6iOk534VpT0h9wLN6spzFfWfgj+ GmoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Jljy54pEN74RXavYP6UBsn4ZTmrWvv0FcPo4p9uFkDI=; b=n+tadKKSL7EypK0jG5NvKx/i8prm/nfHe8f2sGPg6Wu7vshl2k8O5wogyTZmHxAPND 02cygwphcnyudAhpgGfMCwAvWctoMkspASJTarntvK1/eB18bXafzDJB3uUJvGSEHoxm C7hupzOWTBAU4l70gjp/HhrC5rz8gdkQxph5alyieD2MYE9B3oEmqBrrvNqBXEgv3BTk clvkkw6KViY6fnKJ4r/PlxV/cp0yeJh+o2mahcGodpNtZ3bGpg6cO9gL7gik6WP3WbEg AzXaJfb39gMIUdJtCrOrffmZRWtH9GmUSRqhqFs0zGLxv5KpjUiEmJHehvHN7Tl1nefC MLZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17si6747770pgk.581.2019.01.16.13.05.31; Wed, 16 Jan 2019 13:05:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731375AbfAPDcy (ORCPT + 99 others); Tue, 15 Jan 2019 22:32:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729825AbfAPDcx (ORCPT ); Tue, 15 Jan 2019 22:32:53 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF2847A19B; Wed, 16 Jan 2019 03:32:52 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-86.pek2.redhat.com [10.72.12.86]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 161B25F7C2; Wed, 16 Jan 2019 03:32:46 +0000 (UTC) Date: Wed, 16 Jan 2019 11:32:43 +0800 From: Dave Young To: Borislav Petkov Cc: Kairui Song , linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, bhe@redhat.com, kexec@lists.infradead.org, akpm@linux-foundation.org, robert.moore@intel.com, erik.schmauss@intel.com, rafael.j.wysocki@intel.com, lenb@kernel.org, Chao Fan Subject: Re: [PATCH v2 2/2] x86, kexec_file_load: make it work with efi=noruntime or efi=old_map Message-ID: <20190116033243.GB9649@dhcp-128-65.nay.redhat.com> References: <20190115095834.22617-1-kasong@redhat.com> <20190115095834.22617-3-kasong@redhat.com> <20190115231005.GF6596@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190115231005.GF6596@zn.tnic> User-Agent: Mutt/1.9.5 (2018-04-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 16 Jan 2019 03:32:53 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/16/19 at 12:10am, Borislav Petkov wrote: > On Tue, Jan 15, 2019 at 05:58:34PM +0800, Kairui Song wrote: > > When efi=noruntime or efi=oldmap is used, EFI services won't be available > > in the second kernel, therefore the second kernel will not be able to get > > the ACPI RSDP address from firmware by calling EFI services and won't > > boot. Previously we are expecting the user to set the acpi_rsdp= > > on kernel command line for second kernel as there was no way to pass RSDP > > address to second kernel. > > > > After commit e6e094e053af ('x86/acpi, x86/boot: Take RSDP address from > > boot params if available'), now it's possible to set an acpi_rsdp_addr > > parameter in the boot_params passed to second kernel, this commit make > > use of it, detect and set the RSDP address when it's required for second > > kernel to boot. > > > > Tested with an EFI enabled KVM VM with efi=noruntime. > > > > Suggested-by: Dave Young > > Signed-off-by: Kairui Song > > --- > > arch/x86/kernel/kexec-bzimage64.c | 21 +++++++++++++++++++++ > > drivers/acpi/acpica/tbxfroot.c | 3 +-- > > include/acpi/acpixf.h | 2 +- > > 3 files changed, 23 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c > > index 53917a3ebf94..0a90dcbd041f 100644 > > --- a/arch/x86/kernel/kexec-bzimage64.c > > +++ b/arch/x86/kernel/kexec-bzimage64.c > > @@ -20,6 +20,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -255,8 +256,28 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, > > /* Setup EFI state */ > > setup_efi_state(params, params_load_addr, efi_map_offset, efi_map_sz, > > efi_setup_data_offset); > > + > > +#ifdef CONFIG_ACPI > > + /* Setup ACPI RSDP pointer in case EFI is not available in second kernel */ > > + if (!acpi_disabled && (!efi_enabled(EFI_RUNTIME_SERVICES) || efi_enabled(EFI_OLD_MEMMAP))) { > > + /* Copied from acpi_os_get_root_pointer accordingly */ > > + params->acpi_rsdp_addr = boot_params.acpi_rsdp_addr; > > + if (!params->acpi_rsdp_addr) { > > + if (efi_enabled(EFI_CONFIG_TABLES)) { > > + if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) > > + params->acpi_rsdp_addr = efi.acpi20; > > + else if (efi.acpi != EFI_INVALID_TABLE_ADDR) > > + params->acpi_rsdp_addr = efi.acpi; > > + } else if (IS_ENABLED(CONFIG_ACPI_LEGACY_TABLES_LOOKUP)) { > > + acpi_find_root_pointer(¶ms->acpi_rsdp_addr); > > + } > > + } > > + if (!params->acpi_rsdp_addr) > > + pr_warn("RSDP is not available for second kernel\n"); > > + } > > #endif > > Amazing the amount of ACPI RDSP parsing and fiddling patches flying > around these days... > > In any case, this needs to be synchronized with: > > https://lkml.kernel.org/r/20190107032243.25324-1-fanc.fnst@cn.fujitsu.com > > and checked whether the above can be used instead of sprinkling of ACPI > parsing code left and right. Both Baoquan and Chao are cced for comments. The above KASLR patches seems some early code to parsing acpi, but I think in this patch just call acpi function to get the root pointer no need to add the duplicate logic of if/else/else if. Kairui, do you have any reason for the checking? Is there some simple acpi function to just return the root pointer? > > Thx. > > -- > Regards/Gruss, > Boris. > > Good mailing practices for 400: avoid top-posting and trim the reply. Thanks Dave