Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5506648imu; Sat, 1 Dec 2018 19:18:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/XrhgIimPL2XrP+ZZVHtbFm8uu9EYoXDvD5HWQnCNo3+axW5BvseC5VaS1M4REqz49z6qCz X-Received: by 2002:a62:e201:: with SMTP id a1mr10921223pfi.75.1543720731937; Sat, 01 Dec 2018 19:18:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543720731; cv=none; d=google.com; s=arc-20160816; b=kq7th2Ess1GTIGndJ7QpTpz3PhjBOr9UuYXWCtfQmi4SvyjitiR48u2igAcL5twk2f ZwgwMsJJfIbrWXJgeH76cuTVbsbnXIlsIQ5E70LEKJfOZuvBNNOOhVAkkfk7VRoeXCHU o5M6R1ZNX5/qd5WPDFvfgGJCP7ObmRnCDwq8C4lTKArn4uz60sBq+21S19EMdQ7hk29G jJ2fXrEeGuSU4EOnK4IdiWrF581twPXiQbA6zvhdRva9db6dByLFR5robq0IxAUJxh3v gZjugcJFiYwlyDRrS71dEoBLRkJAo6p7pA3+te6M/UyiQhzTx7yE0VbCBuG0fCaulmpy 43Pw== 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=iAuKPyWiuadZDw+wMAUe4a9y3xetNUt4L1K1xyDKpKo=; b=0XrZDhWQ6zmkt+o86MGWG9U2bgAhV4FnHEAcMUffJqNb9e+Myl+HcJONQEJm9KaKP/ YabbuPTJ6rncSmw5GFHsviWQ3Zj+79eSzZuCP3cmI3OuANESflE1sWgfV+TjDGLBZOBH 1Y9Y0dHoxpc8imvoQS1xv/8Hfa7QKHn4hkbQfMpFwdCiV0aiHAzBDZadVikb1WpOuAPf ay1i7Fj1pGil2E7Q2Wok2PawJUCDi13NlFwzG4iiU72l8Rk+y7/BuJWmtGCUX/fxSqlp XEwFZiw3KL3bIQ/1+qscPId+AoZEJZGp9ucSR288tAeuGxqVIC4R13T0+ava7NG0TGG+ MMgQ== 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 s13si9023861pgc.509.2018.12.01.19.18.26; Sat, 01 Dec 2018 19:18:51 -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 S1725763AbeLBDRm (ORCPT + 99 others); Sat, 1 Dec 2018 22:17:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33074 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbeLBDRl (ORCPT ); Sat, 1 Dec 2018 22:17:41 -0500 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 933FC3DDB5; Sun, 2 Dec 2018 03:09:16 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-75.pek2.redhat.com [10.72.12.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 099985D9C9; Sun, 2 Dec 2018 03:09:06 +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, x86@kernel.org, akpm@linux-foundation.org, bhe@redhat.com, dyoung@redhat.com Subject: [PATCH 2/2 v2] kdump,vmcoreinfo: Export the value of sme mask to vmcoreinfo Date: Sun, 2 Dec 2018 11:08:39 +0800 Message-Id: <20181202030839.29945-3-lijiang@redhat.com> In-Reply-To: <20181202030839.29945-1-lijiang@redhat.com> References: <20181202030839.29945-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.29]); Sun, 02 Dec 2018 03:09:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For AMD machine with SME feature, makedumpfile tools need to know whether the crash kernel was encrypted or not. If SME is enabled in the first kernel, the crash kernel's page table(pgd/pud/pmd/pte) contains the memory encryption mask, so need to remove the sme mask to obtain the true physical address. Signed-off-by: Lianbo Jiang --- arch/x86/kernel/machine_kexec_64.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 4c8acdfdc5a7..1860fe24117d 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -352,10 +352,24 @@ void machine_kexec(struct kimage *image) void arch_crash_save_vmcoreinfo(void) { + u64 sme_mask = sme_me_mask; + VMCOREINFO_NUMBER(phys_base); VMCOREINFO_SYMBOL(init_top_pgt); vmcoreinfo_append_str("NUMBER(pgtable_l5_enabled)=%d\n", pgtable_l5_enabled()); + /* + * Currently, the local variable 'sme_mask' stores the value of + * sme_me_mask(bit 47), and also write the value of sme_mask to + * the vmcoreinfo. + * If need, the bit(sme_mask) might be redefined in the future, + * but the 'bit63' will be reserved. + * For example: + * [ misc ][ enc bit ][ other misc SME info ] + * 0000_0000_0000_0000_1000_0000_0000_0000_0000_0000_..._0000 + * 63 59 55 51 47 43 39 35 31 27 ... 3 + */ + VMCOREINFO_NUMBER(sme_mask); #ifdef CONFIG_NUMA VMCOREINFO_SYMBOL(node_data); -- 2.17.1