Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1490961ybb; Fri, 29 Mar 2019 05:42:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOacObZSxSFy7LeiaXWLUGgRoP+Tg1qXKAIVe27VoSyL02uuArYceSLaYtBGrx/A7HGuFH X-Received: by 2002:a65:4689:: with SMTP id h9mr19090047pgr.295.1553863333316; Fri, 29 Mar 2019 05:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553863333; cv=none; d=google.com; s=arc-20160816; b=Ea9WAU6jwdG3dLEVNUCHAQzAhLyNPs8wdgMisv5FxmBHz6jUUwoupqSQ4e7OgReBSe rBFO4HRW7j28ew8S0A8st0Y91JT8DGxFh5uQ+GWW3Gb9xRR+oLLWVujslib9k1WqdhFS Onrw52v/860oZmBy6OodGdO9bjYlutZYr5Gp8souxCFWxS4o02g9IkRZ+k62NPiDyId2 VHeBOBX592c3qYO9iXhsdp3cRgebx/fSiWcob7y671HPIIOTl2IpZ3V4UN4tKXFx0/bL x4dm7c5h9/HmPYvTNH53cukGOgFgZdbpyF49yPfn24jvlmbbdsQ+W6rMCVqSdgJ/wf5v bxTA== 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=PubVEmWseU8TWxBrok0WSIFMsH7MhCQjUN6bu5xKdg2HGZFze5POCHnh0cANyxcPgp cD/E4LYiZTdgB9B3sz+l6xFQ3fQfbme01Ccitu3hrLAVrjMjZqS4krkFA60b+MCa6JM3 xVYqr7vwrJifvUgoi/iC1LdX8KVIxVmA+8Wc2Pt1LPEJWuHpX/NO51+PYew/eqYuJwoj lwK4AyJth2UY8htz8GiobB4NsAjPxwkxWtZBUuGR8iARqmebQF7ZzuJSbtrKLZrmbICB 3V2OsikgdUel9oILWAPSd4r8Sa80fvDIQUViJsrZgyI8bqYYZ7Cz2KejcEsvFUpYa1j+ GPtg== 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 a7si1637559pgt.496.2019.03.29.05.41.57; Fri, 29 Mar 2019 05:42:13 -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 S1729574AbfC2Mj4 (ORCPT + 99 others); Fri, 29 Mar 2019 08:39:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37358 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729384AbfC2Mj4 (ORCPT ); Fri, 29 Mar 2019 08:39:56 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A07E307D84B; Fri, 29 Mar 2019 12:39:56 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 010B11900A; Fri, 29 Mar 2019 12:39:41 +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 2/2 RESEND v10] x86/kexec_file: add reserved e820 ranges to kdump kernel e820 table Date: Fri, 29 Mar 2019 20:39:14 +0800 Message-Id: <20190329123914.20939-3-lijiang@redhat.com> In-Reply-To: <20190329123914.20939-1-lijiang@redhat.com> References: <20190329123914.20939-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 29 Mar 2019 12:39:56 +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