Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp327869imm; Fri, 31 Aug 2018 01:21:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbAbPua2iFMEw2EAioiqBNYsWTFUd8Cx26ylJjPETWbCwVQeqojMQcsaSUVmEt6l6EwqQct X-Received: by 2002:a17:902:a413:: with SMTP id p19-v6mr14144168plq.220.1535703706110; Fri, 31 Aug 2018 01:21:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535703706; cv=none; d=google.com; s=arc-20160816; b=tZqrqbmvWNlXw0qo8Hg52xVFK/H1cVGPJ+inaMohgqkidJj7MdztY7AMeOFDC/PPRm IWTRX0odmjUEHlR5n38NFzB9awQWyhrKhjbIMDoNgU0PjIjWATt2nuE8skDJD6UyOifn 6xjmAdWTVTrFBi8+ucJBQbrPoOJ8oV9GrGg40LiG7ejPrk+OtKXiKw+MjURH7qDJqfuO FFMmtquqylNUGVxH2Ydy4Ukane0ZHZseeULcbzZEWZnDQRgwxkcM5P0yqZmlgnfXh7KY obFn53C7DY7JLGyBb+aEjeeDASPSRisvxNieaSuEHNzJtTKK41zK/KaNjkJwhxMOJwGw 3gWg== 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=Oi9dDI4H/IYapMkZw3KI4/khEYIq2pxwfVrXqOQ7grk=; b=kuJESDoapR9aD+eBN/xisjFPjnudiK3hxRZ0g/X+NnjF5U1CzEhCT96Rsp9A70lJEp yioUqTK+LOXrPb8K96p3r0KEIXN4FhJNB6zV3H2GZbRj0E/Ivl8eveuHNTBAmw7Djo8Q D1R8D8wab6I/TDC8iNjYd0f+704i1qIHX/gZsMQlnUJ61PAktf/MJtd93Ux6DKIpX2km zOeNksl7FJLtHU/s2VVEEQccvwxE4pSDhqisLzvRToceAOtbtJNylqoTd1jGOh9r90/G aN0le2KIYvC8d9PDG/okoAku5097afuHo4bAu6ytFKPSHA3P6JlS2ZxymYteddrsV6PT ImVg== 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 c12-v6si9651987pfk.145.2018.08.31.01.21.31; Fri, 31 Aug 2018 01:21:46 -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 S1727724AbeHaM0Z (ORCPT + 99 others); Fri, 31 Aug 2018 08:26:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40852 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727229AbeHaM0Y (ORCPT ); Fri, 31 Aug 2018 08:26:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B79A6401EF0D; Fri, 31 Aug 2018 08:20:06 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-30.pek2.redhat.com [10.72.12.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA7CC10D18E0; Fri, 31 Aug 2018 08:19:56 +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 2/5 V6] x86/ioremap: strengthen the logic in early_memremap_pgprot_adjust() to adjust encryption mask Date: Fri, 31 Aug 2018 16:19:27 +0800 Message-Id: <20180831081930.31561-3-lijiang@redhat.com> In-Reply-To: <20180831081930.31561-1-lijiang@redhat.com> References: <20180831081930.31561-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 31 Aug 2018 08:20:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 31 Aug 2018 08:20:06 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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 kernel, when SME is enabled, the acpi table and dmi table will need to be remapped without the memory encryption mask. So we have to strengthen the logic in early_memremap_pgprot_adjust(), which makes us have an opportunity to adjust the memory encryption mask. Signed-off-by: Lianbo Jiang --- arch/x86/mm/ioremap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index e01e6c695add..f9d9a39955f3 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -689,8 +689,15 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, encrypted_prot = true; if (sme_active()) { + /* + * In kdump kernel, the acpi table and dmi table will need + * to be remapped without the memory encryption mask. Here + * we have to strengthen the logic to adjust the memory + * encryption mask. + */ 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.17.1