Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1742507ybi; Thu, 20 Jun 2019 03:02:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwp08/xu1SR0Zlogqvn6T0ZRP7wQuh7DeHOEr4+8vgZTXdSjl/ZJz9zjWRTgPsMNJi4mpmC X-Received: by 2002:a63:1865:: with SMTP id 37mr11888989pgy.393.1561024974369; Thu, 20 Jun 2019 03:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561024974; cv=none; d=google.com; s=arc-20160816; b=j+yDHcPS6DV8+LuYLVHVGuI+MnaV09NNSW0BEAeIK1X+kACXPQ20af+DeSElD9gyj8 0esm/UxE7QFEelHcNkFJeHFWY/B+1sMbztWnGLF9rlUQSqiT6Yoz9FgO4XJaOpDg1weH yj4Y99KWyQdQngJnbGjnydxtQ79XQRZcDsPoIIFhYX4sF/HbjLsgsrKXNVwyCjoNtJgp BouZ8fFp1/Xe06vLY4x+bwp6HIi3YRLxRKbtfBNNXA+b3iCp6Cdu7iJVMFPY2HxNrbnW 8rOPMqRaIoUcmplIiWnr3OszuFvcHK02rZ/ddYFoCS2Pdmt9hPVvksZCZVfaVWQL67n1 UNQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=UPkv90uF2Anf0QFRTigvjd0bnuSnlQV0Wt+CGEHfp4w=; b=A7gEyatvRKCVo78/2AzJCyUVbIwCQgzEccFAIGNgaTrINm9fvKSWl8WufC+2CH3idr ndg/6ns0n5QM/OAebFJE2ei59XptPZv9xDlJJEhWuf32+4qA7/H28DzJJXef/Mxf1z9O mEJsDLPBQqnC58ZylxEEhM6hlRJnVFPbtYQBLJmT+ofkFEfB/XnQTM11UOtqFjS9HbF7 bAxque06YaV/FnZCGLo4BfHtsCV8+3KfTZCzWsVbQoxswMxPa5X4LcTHFSlDh83dCBHG K5VuARu9pk6rC3EFoEvoW4xnsvcahQ70mpmdosCh/NkgfWD5tyHT1EATInHocTPJzIU2 i2Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019061801 header.b=XFTbxOUT; 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=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l10si5309848pgq.226.2019.06.20.03.02.29; Thu, 20 Jun 2019 03:02:54 -0700 (PDT) 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=@zytor.com header.s=2019061801 header.b=XFTbxOUT; 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=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730196AbfFTKB4 (ORCPT + 99 others); Thu, 20 Jun 2019 06:01:56 -0400 Received: from terminus.zytor.com ([198.137.202.136]:59145 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbfFTKB4 (ORCPT ); Thu, 20 Jun 2019 06:01:56 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x5KA1Bb3907358 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 20 Jun 2019 03:01:11 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x5KA1Bb3907358 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019061801; t=1561024872; bh=UPkv90uF2Anf0QFRTigvjd0bnuSnlQV0Wt+CGEHfp4w=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=XFTbxOUT1FQ9RWFB0IAmVYeUmqcQHKBgXTIvjQ2Z2gj9vNGWcLbc6/unQ0hY8TqpX 8UNXm5xBGF/HATtlUeczUy//uYqw5xulYuJ8EegFIX4/XOEOCIaaOs8zWpqtvKvMFm srRg4WudLmqcEvaS0VJjlnkdb6YBYBb7GdXd8beea3pwLXiueH6zpszCMwyA494NDl sOhkD9MOVi5aPDtkZzGpqaHYPcszbC15LhSw3LV167loA58xGW2xu9B8HiKLP7d66w bYyElrL1c6V9MdH3VfynQ1xr7NDuGvZZ/K/BYCH0eJoXzRtBzapt78O4y0N3d514AL NJfHWXO7bq31A== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x5KA1AbH907355; Thu, 20 Jun 2019 03:01:10 -0700 Date: Thu, 20 Jun 2019 03:01:10 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Lianbo Jiang Message-ID: Cc: bjorn.helgaas@gmail.com, linux-kernel@vger.kernel.org, wang.yi59@zte.com.cn, hpa@zytor.com, luto@amacapital.net, lijiang@redhat.com, mingo@kernel.org, bp@suse.de, bhe@redhat.com, akpm@linux-foundation.org, thomas.lendacky@amd.com, dyoung@redhat.com, mingo@redhat.com, gustavo@embeddedor.com, x86@kernel.org, peterz@infradead.org, tglx@linutronix.de Reply-To: dyoung@redhat.com, gustavo@embeddedor.com, mingo@redhat.com, akpm@linux-foundation.org, thomas.lendacky@amd.com, peterz@infradead.org, tglx@linutronix.de, x86@kernel.org, hpa@zytor.com, luto@amacapital.net, bjorn.helgaas@gmail.com, wang.yi59@zte.com.cn, linux-kernel@vger.kernel.org, bp@suse.de, bhe@redhat.com, mingo@kernel.org, lijiang@redhat.com In-Reply-To: <20190423013007.17838-4-lijiang@redhat.com> References: <20190423013007.17838-4-lijiang@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/kdump] x86/crash: Add e820 reserved ranges to kdump kernel's e820 table Git-Commit-ID: 980621daf368f2b9aa69c7ea01baa654edb7577b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=0.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF,FREEMAIL_FORGED_REPLYTO autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 980621daf368f2b9aa69c7ea01baa654edb7577b Gitweb: https://git.kernel.org/tip/980621daf368f2b9aa69c7ea01baa654edb7577b Author: Lianbo Jiang AuthorDate: Tue, 23 Apr 2019 09:30:07 +0800 Committer: Borislav Petkov CommitDate: Thu, 20 Jun 2019 10:05:06 +0200 x86/crash: Add e820 reserved ranges to kdump kernel's e820 table At present, when using the kexec_file_load() syscall to load the kernel image and initramfs, for example: kexec -s -p xxx the kernel does not pass the e820 reserved ranges to the second kernel, which might cause two problems: 1. MMCONFIG: A device in PCI segment 1 cannot be discovered by the kernel PCI probing without all the e820 I/O reservations being present in the e820 table. Which is the case currently, because the kdump kernel does not have those reservations because the kexec command does not pass the I/O reservation via the "memmap=xxx" command line option. Further details courtesy of Bjorn Helgaas¹: I think you should regard correct MCFG/ECAM usage in the kdump kernel as a requirement. MMCONFIG (aka ECAM) space is described in the ACPI MCFG table. If you don't have ECAM: (a) PCI devices won't work at all on non-x86 systems that use only ECAM for config access, (b) you won't be able to access devices on non-0 segments (granted, there aren't very many of these yet, but there will be more in the future), and (c) you won't be able to access extended config space (addresses 0x100-0xfff), which means none of the Extended Capabilities will be available (AER, ACS, ATS, etc). 2. The second issue is that the SME kdump kernel doesn't work without the e820 reserved ranges. When SME is active in the kdump kernel, those reserved regions are still decrypted, but because those reserved ranges are not present at all in kdump kernel's e820 table, they are accessed as encrypted. Which is obviously wrong. [1]: https://lkml.kernel.org/r/CABhMZUUscS3jUZUSM5Y6EYJK6weo7Mjj5-EAKGvbw0qEe%2B38zw@mail.gmail.com [ bp: Heavily massage commit message. ] Suggested-by: Dave Young Signed-off-by: Lianbo Jiang Signed-off-by: Borislav Petkov Cc: Andrew Morton Cc: Andy Lutomirski Cc: Baoquan He Cc: Bjorn Helgaas Cc: dave.hansen@linux.intel.com Cc: Dave Young Cc: "Gustavo A. R. Silva" Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: kexec@lists.infradead.org Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Tom Lendacky Cc: x86-ml Cc: Yi Wang Link: https://lkml.kernel.org/r/20190423013007.17838-4-lijiang@redhat.com --- arch/x86/kernel/crash.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 576b2e1bfc12..32c956705b8e 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -381,6 +381,12 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params) walk_iomem_res_desc(IORES_DESC_ACPI_NV_STORAGE, flags, 0, -1, &cmd, memmap_entry_callback); + /* Add e820 reserved ranges */ + cmd.type = E820_TYPE_RESERVED; + flags = IORESOURCE_MEM; + walk_iomem_res_desc(IORES_DESC_RESERVED, flags, 0, -1, &cmd, + memmap_entry_callback); + /* Add crashk_low_res region */ if (crashk_low_res.end) { ei.addr = crashk_low_res.start;