Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4510427imu; Tue, 15 Jan 2019 01:01:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN6h7JSX4idk0TM/z/8qr0G4pkrjM+YKn9ur+SpYv9u0G2xxtxVy0X7wk3PNGsnYj2+K2oZU X-Received: by 2002:a63:9a52:: with SMTP id e18mr2872572pgo.14.1547542894273; Tue, 15 Jan 2019 01:01:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547542894; cv=none; d=google.com; s=arc-20160816; b=MiJfif0JMnnd41lk9NDUk9GvGm6BaFYSsLLDdBdT52eg88AfP6AxtVVFkIbG7+JOeA 04b0+jkc0vL8d3MRLtq4SLD1d7sRbhGf1WsGddsxx+5tkoxYm//LHxkKw8FQ+Q9/KIup MhwnNjTaT0ajIgzdO9MOjZHTf0OiOht0HQMEC5BZKeQd/huUFJNnZLce0210qSLBbBOg RjevYVMJV0rJxy4hy0i2+kokuXToRMLVC33ddxvm+rW58DKhL1d3RO/VpVHScecT8UDf U5F6+a+lY1E89p+4Golrftjb/r/0iKuDm4qt+pXmeYtHOj2qfaIFhQ4SBaahRKzxU66b n40w== 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=M014Y3YRRdjWGbd1JFlFhy7ikeMWo+32959zsfU28Ns=; b=uTzb5nF1PhAcd4zQr2lfvuSFAG0wtTRmKIPX1CjWj67pg2pyqNvrhkCoX5Q+Z6kGXb xH9blmAAtrFAKIo+AulQTnlaqlQ/N8KbB6OuS+lCc8nab6y9ZQQId4bWPX/DzcYxMdQJ j3ew2SgEpaOvwEXA7gHczn1jlpV+t3y5wZrVtO2Qn/1W6xlllFs9YlvSrCgpuf0SGIAs ts/qKVgomhCfex57AjVqAS++PH4VTYRZNLxtveIqjDuNhR3+OtrMKx66BbjlbURpUbwN JH3a5O7HCm909MQc5+GC3w1OKDmJYd53m2Bee4pmJOwCB5caxPvxWYPEf+AAd4/BrQJ9 +mbQ== 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 s4si2549120plr.306.2019.01.15.01.01.17; Tue, 15 Jan 2019 01:01:34 -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 S1728440AbfAOImX (ORCPT + 99 others); Tue, 15 Jan 2019 03:42:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19040 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725869AbfAOImX (ORCPT ); Tue, 15 Jan 2019 03:42:23 -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 878F4A459D; Tue, 15 Jan 2019 08:42:22 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-57.pek2.redhat.com [10.72.12.57]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67077608E8; Tue, 15 Jan 2019 08:42:17 +0000 (UTC) Date: Tue, 15 Jan 2019 16:42:13 +0800 From: Dave Young To: Kairui Song Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, akpm@linux-foundation.org, robert.moore@intel.com, erik.schmauss@intel.com, rafael.j.wysocki@intel.com, lenb@kernel.org Subject: Re: [PATCH 2/2] x86, kexec_file_load: make it work with efi=noruntime or efi=oldmap Message-ID: <20190115084213.GA6468@dhcp-128-65.nay.redhat.com> References: <20190109064727.27936-1-kasong@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190109064727.27936-1-kasong@redhat.com> 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.38]); Tue, 15 Jan 2019 08:42:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/09/19 at 02:47pm, 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 a 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 > > +#endif > /* Setup EDD info */ > memcpy(params->eddbuf, boot_params.eddbuf, > EDDMAXNR * sizeof(struct edd_info)); > diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c > index 483d0ce5180a..dac1e34a931c 100644 > --- a/drivers/acpi/acpica/tbxfroot.c > +++ b/drivers/acpi/acpica/tbxfroot.c > @@ -108,8 +108,7 @@ acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp) > * > ******************************************************************************/ > > -acpi_status ACPI_INIT_FUNCTION > -acpi_find_root_pointer(acpi_physical_address *table_address) > +acpi_status acpi_find_root_pointer(acpi_physical_address *table_address) > { > u8 *table_ptr; > u8 *mem_rover; > diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h > index 7aa38b648564..869d75ecaf7d 100644 > --- a/include/acpi/acpixf.h > +++ b/include/acpi/acpixf.h > @@ -474,7 +474,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION > ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION > acpi_reallocate_root_table(void)) > > -ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION > +ACPI_EXTERNAL_RETURN_STATUS(acpi_status > acpi_find_root_pointer(acpi_physical_address > *rsdp_address)) > ACPI_EXTERNAL_RETURN_STATUS(acpi_status > -- > 2.20.1 > Kairui, thanks for the patches, did a test, it works for me. Seems the two patches are not in a thread, can you resend them together? Dave