Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3141481yba; Mon, 22 Apr 2019 21:08:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaEG2jbHnkCOKRicrcgPup5p5uaxGkrb74V794WGrbxZECkf1zqo1lLXhPkJ1Wf4z1TbfA X-Received: by 2002:a62:1815:: with SMTP id 21mr24462147pfy.107.1555992515154; Mon, 22 Apr 2019 21:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555992515; cv=none; d=google.com; s=arc-20160816; b=apbIqR37Q4l8hCZVAOMFFEr30dIEppX+8NJ2Vdwqm9kDzXLa4Zd8dtHBQq5WZ/3hs0 /v7TyMdHY/is1fh0HHqrsS6Z5DLHZW71QCmqf2V8HQuq+3hzbDyZ/bAl3rYlDbuKOlRE Y0Maa54MVa2o3UKQMHzKdrJfm2a1flJvHlqFjYqlZr3aOCAEo7bDDnbUW0H2splT1NjF 7wzpPJ7iToc2QP3QcyY2/0uoGtE6yal6lBWX8U5M+TkeI8Y8IQsuH3GBKHMj1A7lAbMU 1vh37mQ+HytG8sdF49g11V0PvYZ8DCd3JljWZH1bVVm+0L2t1yL3U8XGaMvQ+6ZfjW1D 3wbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=jxTOfR8Euhe+wXGUwv6TR/TkgJFGDIRZqYOIR/8Pds8=; b=gg1f3U/KSTEh/M/ahkHne75Tw6R7YdFURfi+An//171K4RSKqYLltJ6zBMvBvjGBNz oJ+NfV8+Ye4yQJI6s9mZQxIojdhfNSuCRPigmknUh6sRs/ITFAbUs/8hfZ4VtVEXJ9xy vdLrOm/oE2bR2ieBL6FsqgGx/Pw0mtv4NC1wQP+O21AxF+1xWNFvby4JLj70siPjTLHX GG1nVQebPvj6lcWUOS+KPCdaeQyp0xcvJbaTX57SsdQ6wiQPao2aeQaKmY5A95OJA4Ej UeWrn0Cr1Qy9/Ryfe3TMVHw4xclst68RDSaxlfcRcZqIsARk1LHVGZnekosvXhXo7s1P 5l7A== 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 z11si14734130plk.81.2019.04.22.21.08.20; Mon, 22 Apr 2019 21:08:35 -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; 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 S1729356AbfDWBa6 (ORCPT + 99 others); Mon, 22 Apr 2019 21:30:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44232 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729062AbfDWBa6 (ORCPT ); Mon, 22 Apr 2019 21:30:58 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6064F3086215; Tue, 23 Apr 2019 01:30:58 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-81.pek2.redhat.com [10.72.12.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id F34AD60141; Tue, 23 Apr 2019 01:30:46 +0000 (UTC) From: Lianbo Jiang To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, akpm@linux-foundation.org, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, x86@kernel.org, hpa@zytor.com, dyoung@redhat.com, bhe@redhat.com, Thomas.Lendacky@amd.com Subject: [PATCH 3/3 v11] x86/kexec_file: add reserved e820 ranges to kdump kernel e820 table Date: Tue, 23 Apr 2019 09:30:07 +0800 Message-Id: <20190423013007.17838-4-lijiang@redhat.com> In-Reply-To: <20190423013007.17838-1-lijiang@redhat.com> References: <20190423013007.17838-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 23 Apr 2019 01:30:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: The first one is the MMCONFIG issue. The basic problem is that this device is in PCI segment 1 and the kernel PCI probing can not find it without all the e820 I/O reservations being present in the e820 table. And 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. (This problem does not show up for other vendors, as SGI is apparently the actually fails for everyone, but devices in segment 0 are then found by some legacy lookup method.) The workaround for this is to pass the I/O reserved regions to the kdump kernel. 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 albe to access devices on non-0 segments, (c) you won't be able to access extended config space( address 0x100-0xffff), which means none of the Extended Capabilities will be available(AER, ACS, ATS, etc). [Bjorn's comment] The second issue is that the SME kdump kernel doesn't work without the e820 reserved ranges. When SME is active in kdump kernel, actually, those reserved regions are still decrypted, but because those reserved ranges are not present at all in kdump kernel e820 table, those reserved regions are considered as encrypted, it goes wrong. The e820 reserved range is useful in kdump kernel, so it is necessary to pass the e820 reserved ranges to the kdump kernel. Suggested-by: Dave Young Signed-off-by: Lianbo Jiang --- 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 17ffc869cab8..1db2754df9e9 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; -- 2.17.1