Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3536741imm; Mon, 2 Jul 2018 00:29:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJGamMa8Rh/eO9Z5FnNwQ3KNZJD4EHtg8dRtmDQlM/ilHBpDLQsHvLkox5v2S/DJFixmPpr X-Received: by 2002:a65:638a:: with SMTP id h10-v6mr21026270pgv.269.1530516561403; Mon, 02 Jul 2018 00:29:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530516561; cv=none; d=google.com; s=arc-20160816; b=peYt9hGfPBcNHxVM/qgjB689Za7WBCl/3CTq5SMjG21Yc+gqpJ7D9lfj6uXBVl2Egd e1tsSxbpTxsGH2Y9cHJy6KZF6kBaWt25YnKuIjJx6E5P9VwyPh6POoV4hG9IU16N58SZ 1V335DwJK9WhRXNUaoa3qVtQf6cI5onUfNuArvz1BlPXpoGUaf4yi0uKDrh0SMJc47dR rwt+DrefWq9sI4eE1RT8ScYje0kEAm8tnrHgP1NYqdTzlaVXAwGmp4Q3xy4upfJjyeca teqNmYCFqiUSms8HNLaHx8LpwOvHVA9WvaDLF/iXd4UqVz6jO6RuWmbTRSnfpyJysh/i kigQ== 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:arc-authentication-results; bh=+zzvnrG5AVyOwQUzruPxZIEhCYEbvNEiJFQF+ngsad8=; b=QM5N0VNk4uL53d1+HPwrzwn6Y8SZj1GxgYWWRw9MWK39tJN1efFyqDqao94zZHX0Y4 V9Lp6AbjemT/OrRUS9WZyyqqz74XroWYKQMq23f5FcgZEHbZqgfcTKrCT/VjbWPAyTj4 PYwvYV09JR5kn9iuLIK0y6nLJrEcwPOrTwmqKcucxGuw1SE89Ee5gbgSl/1lWAAUBH/O CCHzMgfbwfo8McsNM5hWXA89g3HgTuayBDyB3iaQ6pNSiFoqtENoyYvaSBftNuCAziri wvaRZ+/HdezZ9SvS+W6hjtGPEY4AKwYJygCBt+qcpbJdokpizxGcAo9MNjY9deL4YIiK amNw== 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 m187-v6si14299129pgm.418.2018.07.02.00.29.07; Mon, 02 Jul 2018 00:29:21 -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 S932548AbeGBH1Z (ORCPT + 99 others); Mon, 2 Jul 2018 03:27:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43150 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932302AbeGBH1V (ORCPT ); Mon, 2 Jul 2018 03:27:21 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ACD097CBBA; Mon, 2 Jul 2018 07:27:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-103.pek2.redhat.com [10.72.12.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FE01178BA; Mon, 2 Jul 2018 07:27:13 +0000 (UTC) From: Lianbo Jiang To: linux-kernel@vger.kernel.org Cc: mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, ebiederm@xmission.com, joro@8bytes.org, thomas.lendacky@amd.com, dyoung@redhat.com, kexec@lists.infradead.org, iommu@lists.linux-foundation.org, bhe@redhat.com Subject: [PATCH 4/5 V5] Adjust some permanent mappings in unencrypted ways for kdump when SME is enabled. Date: Mon, 2 Jul 2018 15:26:38 +0800 Message-Id: <20180702072639.10110-5-lijiang@redhat.com> In-Reply-To: <20180702072639.10110-1-lijiang@redhat.com> References: <20180702072639.10110-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 02 Jul 2018 07:27:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 02 Jul 2018 07:27:20 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lijiang@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For kdump, the acpi table and dmi table will need to be remapped in unencrypted ways during early init, they have just a simple wrapper around early_memremap(), but the early_memremap() remaps the memory in encrypted ways by default when SME is enabled, so we put some logic into the early_memremap_pgprot_adjust(), which will have an opportunity to adjust it. Signed-off-by: Lianbo Jiang --- arch/x86/mm/ioremap.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index e01e6c6..3c1c8c4 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -689,8 +689,17 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, encrypted_prot = true; if (sme_active()) { + /* + * In kdump mode, the acpi table and dmi table will need to + * be remapped in unencrypted ways during early init when + * SME is enabled. They have just a simple wrapper around + * early_memremap(), but the early_memremap() remaps the + * memory in encrypted ways by default when SME is enabled, + * so we must adjust it. + */ if (early_memremap_is_setup_data(phys_addr, size) || - memremap_is_efi_data(phys_addr, size)) + memremap_is_efi_data(phys_addr, size) || + is_kdump_kernel()) encrypted_prot = false; } -- 2.9.5