Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1931465ima; Mon, 22 Oct 2018 00:49:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV62jKnc/9zccp3BYuElUttg9j4HoATL2Z8QZRRdwzxI2oXJGJfYrdgafYrbLdiS5aOK2YvxG X-Received: by 2002:a17:902:96a:: with SMTP id 97-v6mr10720216plm.32.1540194568064; Mon, 22 Oct 2018 00:49:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540194568; cv=none; d=google.com; s=arc-20160816; b=hPq3Z651lifL+jp0SA4HihlDrbxZHiTYN0KpkSLeEDX13ApjqLUzFkOFoNQ74QunGP uUt/JeEnb0wqHpPYO/0UxHaP6QAZsy0aTZyZT7LtNDcQ8rjx114qEcOcV//j8JD4aX76 s3aZ3x5rejwPxxPR0WRQkVZ5bv2SKj+Oe/0wvBJYO4GjYwH3pRuh9n8MFd7bjE5zXjkj MNJDpWuPi3ROzVQDqppMg6NmKIxFKv65posFsn5X8U5RDrVuT00KpYUB+/7U99D5aCfd QnPz5Z5mczqgN2Y1CL1vu3l0UAZhbXmmFSWVcx1elEhPX8EhPFwifnD6h/NadBB17l5S Oc+g== 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=e7o/OPU+XNenC0TFnX1cJPn2T9bnTR7AhIJzucYOJqk=; b=beJ/peiHfaB3lLO4iPuu0uvJfkb/bG5LjCEBoV1vIwNnNvWdoD3UwrqVMvzQE1OCtW pl44KrQkEKvsRSV3og4qRDzij+atRIJ2NNPTlx7sNvfpFG8pTbEMwJRZIMTqEd7YRBpe jOo/KBUc2sNdO5lTXMNHjAXeBYaYe2P7DpMh6aIO3oOjXJT5DcjOZgU03m6iyVxNr7xD Gppo1PD6NhYzq9mfWjRnHelZyx/Fly1iKLKiRimzh20nOgSw5Ycx5FkUICXUzL2WY17q CSltxiMFmgqHkd9CkGwCAct7imTYTuNjs1C9G90AzApghJQU0Xdm8RC7FKfTZe6wkNXw mcHA== 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 q22-v6si5341985pll.178.2018.10.22.00.49.12; Mon, 22 Oct 2018 00:49:28 -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 S1727702AbeJVQEy (ORCPT + 99 others); Mon, 22 Oct 2018 12:04:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53124 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbeJVQEx (ORCPT ); Mon, 22 Oct 2018 12:04:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0B9883F3C; Mon, 22 Oct 2018 07:47:30 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-68.pek2.redhat.com [10.72.12.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EFE06FEC0; Mon, 22 Oct 2018 07:47:21 +0000 (UTC) From: Lianbo Jiang To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, x86@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, thomas.lendacky@amd.com, dyoung@redhat.com, bhe@redhat.com Subject: [PATCH 1/2 v4] x86/kexec_file: add e820 entry in case e820 type string matches to io resource name Date: Mon, 22 Oct 2018 15:47:06 +0800 Message-Id: <20181022074707.13901-2-lijiang@redhat.com> In-Reply-To: <20181022074707.13901-1-lijiang@redhat.com> References: <20181022074707.13901-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 22 Oct 2018 07:47:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kdump uses walk_iomem_res_desc() to iterate io resources, then adds matched desc to e820 table for kdump kernel. But IORES_DESC_NONE resource type includes several different e820 types, we need add exact e820 type to kdump kernel e820 table, thus it also needs an extra checking in memmap_entry_callback() to match the e820 type and resource name. Suggested-by: Dave Young Signed-off-by: Lianbo Jiang --- arch/x86/include/asm/e820/api.h | 2 ++ arch/x86/kernel/crash.c | 6 +++++- arch/x86/kernel/e820.c | 2 +- kernel/resource.c | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820/api.h index 62be73b23d5c..6d5451b36e80 100644 --- a/arch/x86/include/asm/e820/api.h +++ b/arch/x86/include/asm/e820/api.h @@ -42,6 +42,8 @@ extern void e820__register_nosave_regions(unsigned long limit_pfn); extern int e820__get_entry_type(u64 start, u64 end); +extern const char *e820_type_to_string(struct e820_entry *entry); + /* * Returns true iff the specified range [start,end) is completely contained inside * the ISA region. diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index f631a3f15587..ae724a6e0a5f 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -37,6 +37,7 @@ #include #include #include +#include /* Used while preparing memory map entries for second kernel */ struct crash_memmap_data { @@ -314,11 +315,14 @@ static int memmap_entry_callback(struct resource *res, void *arg) struct crash_memmap_data *cmd = arg; struct boot_params *params = cmd->params; struct e820_entry ei; + const char *name; ei.addr = res->start; ei.size = resource_size(res); ei.type = cmd->type; - add_e820_entry(params, &ei); + name = e820_type_to_string(&ei); + if (res->name && !strcmp(name, res->name)) + add_e820_entry(params, &ei); return 0; } diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index c88c23c658c1..f9761b2f7abb 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -1012,7 +1012,7 @@ void __init e820__finish_early_params(void) } } -static const char *__init e820_type_to_string(struct e820_entry *entry) +const char *e820_type_to_string(struct e820_entry *entry) { switch (entry->type) { case E820_TYPE_RESERVED_KERN: /* Fall-through: */ diff --git a/kernel/resource.c b/kernel/resource.c index b3a3a1fc499e..6285a6b4de6c 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -366,6 +366,7 @@ static int find_next_iomem_res(resource_size_t start, resource_size_t end, res->end = min(end, p->end); res->flags = p->flags; res->desc = p->desc; + res->name = p->name; return 0; } -- 2.17.1