Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp911822imu; Wed, 16 Jan 2019 09:29:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN4pqokUp83WcYgUh1bHrx2R6QPQVnx32QxBjtHJcrHKdIROTqcHgowrlJkVctkqB6w70gps X-Received: by 2002:a62:9913:: with SMTP id d19mr10848130pfe.107.1547659781375; Wed, 16 Jan 2019 09:29:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547659781; cv=none; d=google.com; s=arc-20160816; b=E0HaJjI2xaRq44UbPkv8IeHs9Jsj2oQOXlzosFJrJT6ChT0uU4gBhA2gFfCIs10hHv DxihCuYJ/cc1Owh6jDy6QBm3qwUZGohUlnJnzUsLsBVh9oUyzAWJcZA6d5zm5lVhwJfh TL90DRiFyAxy0wx8LmzofTjJVNnWq+woEOaf9ezUuWk1OwxmwhHcOSM09yklJYsVWxl6 59sBkbUFaDMebHZVIXNLmD79wu6LkBptpgXNOS8vnrFEPTlifnRl/f6zFpirdZmxGmq7 1YRULs16m6ppBesolLCqDaR1a+jDTfi/rd19eB3s1TBqTjnflZ5HFmrFdzFCsdZXcyr2 hyMg== 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:dkim-signature; bh=k1koKEKrTYjaI/KXHMa/+DVMU50seZGxyRktv/1YJ1w=; b=BlXa7tLXEQTXNmRlJc9dpUvfEnQRcdqspxyxwrZVwOnvxkfiLsytt5ZpLsfhwWJAl+ utD0AzwdOy3afui6X63ytpHtP+2XJYkM1Qo7Do/V8aFDXavLTQwzmeOgI7bod1wC3sEw U83yIO0BGJiTI1mQ9GSNWYv8QDek6Y9/NV+9A8FYKFaaWNtJjLenp0NDuZrBIDHcNDwa tyTKYJz8E52/YcY2jCLYhuHUbppUERzRQTUWE9qGZ0AXuZ9eP0q9Tchp8jE9YhAmKDMO 7Q7coN4/uU3umG6s9ZMuwVDUoMrgcW/XQYCF+joDyD3YO9rh/IdqDpruYxSCwxbXo2AZ APjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=EqTHHWjb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g98si7197058plb.99.2019.01.16.09.29.21; Wed, 16 Jan 2019 09:29:41 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=EqTHHWjb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391388AbfAOXKV (ORCPT + 99 others); Tue, 15 Jan 2019 18:10:21 -0500 Received: from mail.skyhub.de ([5.9.137.197]:40386 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728858AbfAOXKU (ORCPT ); Tue, 15 Jan 2019 18:10:20 -0500 Received: from zn.tnic (p200300EC2BCBB400BDE8DF251329FBA0.dip0.t-ipconnect.de [IPv6:2003:ec:2bcb:b400:bde8:df25:1329:fba0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 3E72D1EC078A; Wed, 16 Jan 2019 00:10:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1547593819; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=k1koKEKrTYjaI/KXHMa/+DVMU50seZGxyRktv/1YJ1w=; b=EqTHHWjbvFPs7N80hJ4TCK8AEEtKM5cLyq7V8b+7JGragmDQaLj4HZ77S65KWeKwsgXYHU rhYiYm3In7HLuvqFeLulbmuKwO8FHPpcEcBJYeUzIJKjtiWxhz56/yEVFkMyLgs3hxrkBn Nw86O+ufNtEdKcKiSBJlUXsdC9zON0Q= Date: Wed, 16 Jan 2019 00:10:05 +0100 From: Borislav Petkov To: Kairui Song Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, dyoung@redhat.com, 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 Subject: Re: [PATCH v2 2/2] x86, kexec_file_load: make it work with efi=noruntime or efi=old_map Message-ID: <20190115231005.GF6596@zn.tnic> References: <20190115095834.22617-1-kasong@redhat.com> <20190115095834.22617-3-kasong@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190115095834.22617-3-kasong@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.