Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1627291imu; Sun, 16 Dec 2018 05:19:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/U8QAjl9tYRm23SV2PDaJWcwWBpF361Xnxu4IsgkD94M0USYd+8jdEd+KbGpQkXUwXfckLD X-Received: by 2002:a17:902:4464:: with SMTP id k91mr9552828pld.13.1544966364563; Sun, 16 Dec 2018 05:19:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544966364; cv=none; d=google.com; s=arc-20160816; b=Lz+OfRb2gQGTfLxSRmQf7Yth/3zXs6eeTZftTfg/e1pxjOQ3MtGpxDVqACqobgFG4S XtznZ0e40d6oNO2zEb3wS2/Fo9Sfk4kZA8Cbb58/mr49C+UAqKOA5w21IifWDuOesn6f vebNkyQ8/ji5a0Kv8EUMn/95jzn7ZREtbcjhrHBrhGC29FKsTOeJ05HjJUF2uksbU/Wc 8w0bLqxrq5GcUt5TH39/rv/Ni27NVfzfjlLBmCYMrUP4cv1Njc6EojXgIMVkCaWInd4A anHjQJkxaVjyITMNYiXkEjpB+1k4CkrUFeH5CNIQbGCVbTMBt3Nq4ZKDfLdII5vvI2uB ffSg== 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=QKcOvm0N2mO72IFIrDOSpz36ne4VDQA/TlHQqrGuykJiZS45XPrtTXF4vOqpa7jgP9 vtPTFa9c8BqnfS9XyU6YfrIKnpmJ3lF2Ft+PJ7dRO6wlFU5yvPJ9KmlIjct2bszdiQQ+ r+orTRUcIrt5v+e5UzUVzjLB1V9IBRHllQaLn029gIxZHV1JWlRQrjB1PX67yFklKeQq 2BFrJ0LP/C8fPF9Vk72NNPUON8xUd3smgE0rE2wktoBoDZZ9i8Za5SJR883RzwKmL894 PiOHoyPVysM63pagMkrGd2xpIBn9UFKkV0gGS4uDKBT9LFWJn07FpNqEtrWLovO20plM F/wA== 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 r7si8767268ple.281.2018.12.16.05.19.09; Sun, 16 Dec 2018 05:19:24 -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 S1730649AbeLPNQn (ORCPT + 99 others); Sun, 16 Dec 2018 08:16:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54118 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730382AbeLPNQn (ORCPT ); Sun, 16 Dec 2018 08:16:43 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B2AD183F44; Sun, 16 Dec 2018 13:16:42 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-64.pek2.redhat.com [10.72.12.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4A7D608F3; Sun, 16 Dec 2018 13:16:37 +0000 (UTC) From: Lianbo Jiang To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, akpm@linux-foundation.org, bhe@redhat.com, dyoung@redhat.com, linux-doc@vger.kernel.org Subject: [PATCH 2/2 v3] kdump,vmcoreinfo: Export the value of sme mask to vmcoreinfo Date: Sun, 16 Dec 2018 21:16:17 +0800 Message-Id: <20181216131617.2612-3-lijiang@redhat.com> In-Reply-To: <20181216131617.2612-1-lijiang@redhat.com> References: <20181216131617.2612-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 16 Dec 2018 13:16:42 +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