Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3168742yba; Mon, 22 Apr 2019 21:53:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBmW2AlxR3855epxP6uK79DEtPfh7vk6+jdk8/XTQJY6XoM6kroF0uSA1eUU6CXDXBOl3b X-Received: by 2002:a17:902:b602:: with SMTP id b2mr24157524pls.293.1555995236335; Mon, 22 Apr 2019 21:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555995236; cv=none; d=google.com; s=arc-20160816; b=If0eXYRaJ54cbr76KmxzTk9FFH+DENvZJJMfG3m811Zpm0+EpVITrrZ+necq7bip3a Q44ecH0gOaMWfUBPP/PcX6JIVZlh98/iAdMsNFj4JdeKmWnoFEE3+HPnYhR2sV144And Ofn7kLNvltSrpbbdHXdtptluBCTiqZfZFZ/PXmRhGafT8s7O9FiBU+HFfafVxTY73srp /a5n9BoxO0rZGOuToHC/6n5n2lH4jl7g27Nf+Aytzaib/WxPZlG5vHRZ8IEg6tldPoMO 9o5bUsMEsr7lnkkVTUmG+W0Njtd3cTOrRWwxk9RvlzZT/FLG1fyrCXCr9XQylLzNNccp xsBQ== 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=soIUfrTIJNDvHQXsnK+gK+juxjizNbmeJpP3EANzgKA=; b=ogYvCwQ4BwBDnHqYObn+SM4CT1eTSWwv55EH+B4acL6CxFcmy6FWi7wBFfxzlBzemU Q3/q7yPp8EariBvZh1rfAJlY1Rre4f5lMQqUSlUXyps5jGu+BWmQpV3BUZ26nBXis3EQ HvkFPl57zE+LWyqjwYYfN8Sctacj11MfQKw47CR1ytx67gt/5j9mBypk9KJZl8ZpBMKl +oj3oF//kjSNbqbybyQfacetpA7T+1QxuH6xiif7QEalUfWgPQ+8Z0ZmK0oovfO3rUUU SR/6Za0o9+5ouDqPIvqSB8usnlCdP0/HGwOG9alR2h094KXhccdFB+NOp39W7Ga2Gkf8 cXiw== 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 m2si14480336pll.44.2019.04.22.21.53.41; Mon, 22 Apr 2019 21:53:56 -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 S1729290AbfDWBad (ORCPT + 99 others); Mon, 22 Apr 2019 21:30:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5204 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729062AbfDWBad (ORCPT ); Mon, 22 Apr 2019 21:30:33 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93D0C30ADBA6; Tue, 23 Apr 2019 01:30:32 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-81.pek2.redhat.com [10.72.12.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FAB160141; Tue, 23 Apr 2019 01:30:23 +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 1/3 v11] x86/e820, resource: add a new I/O resource descriptor 'IORES_DESC_RESERVED' Date: Tue, 23 Apr 2019 09:30:05 +0800 Message-Id: <20190423013007.17838-2-lijiang@redhat.com> In-Reply-To: <20190423013007.17838-1-lijiang@redhat.com> References: <20190423013007.17838-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 23 Apr 2019 01:30:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When doing kexec_file_load(), the first kernel needs to pass the e820 reserved ranges to the second kernel, because some devices may use it in kdump kernel, such as PCI devices. But, the kernel can not exactly match the e820 reserved ranges when walking through the iomem resources via the 'IORES_DESC_NONE', because there are several types of e820 that are described as the 'IORES_DESC_NONE' type. Please refer to the e820_type_to_iores_desc(). Therefore, add a new I/O resource descriptor 'IORES_DESC_RESERVED' for the iomem resources search interfaces. It is helpful to exactly match the reserved resource ranges when walking through iomem resources. Suggested-by: Borislav Petkov Signed-off-by: Lianbo Jiang --- arch/x86/kernel/e820.c | 2 +- include/linux/ioport.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 2879e234e193..16fcde196243 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -1050,10 +1050,10 @@ static unsigned long __init e820_type_to_iores_desc(struct e820_entry *entry) case E820_TYPE_NVS: return IORES_DESC_ACPI_NV_STORAGE; case E820_TYPE_PMEM: return IORES_DESC_PERSISTENT_MEMORY; case E820_TYPE_PRAM: return IORES_DESC_PERSISTENT_MEMORY_LEGACY; + case E820_TYPE_RESERVED: return IORES_DESC_RESERVED; case E820_TYPE_RESERVED_KERN: /* Fall-through: */ case E820_TYPE_RAM: /* Fall-through: */ case E820_TYPE_UNUSABLE: /* Fall-through: */ - case E820_TYPE_RESERVED: /* Fall-through: */ default: return IORES_DESC_NONE; } } diff --git a/include/linux/ioport.h b/include/linux/ioport.h index da0ebaec25f0..6ed59de48bd5 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -133,6 +133,7 @@ enum { IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, IORES_DESC_DEVICE_PRIVATE_MEMORY = 6, IORES_DESC_DEVICE_PUBLIC_MEMORY = 7, + IORES_DESC_RESERVED = 8, }; /* helpers to define resources */ -- 2.17.1