Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2918056ybi; Mon, 10 Jun 2019 00:37:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxqxCJKdqPboFFL1aUFJlQwZrvlthHxDjQq4rFPH0gW2tlFBHdaTLl0UflEfzaO1xIXuWce X-Received: by 2002:a63:e54d:: with SMTP id z13mr14498993pgj.132.1560152272330; Mon, 10 Jun 2019 00:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560152272; cv=none; d=google.com; s=arc-20160816; b=jAl7c/XtdMKNLlbHK64IjiceCrPg3lc8P2dcMfgOjqYOoFDLOkVY5Tefy337odOHxA TnxXKdClJQcXwyodyM/VcgogrgObQ5gzNkOL+M5jPHGUdApQcPONRq2v4r6yNdVRoDO9 XXd/XRz2CxxYp9HyOynC4nI+KqT29h8+S7ttzeBcV5iZDWlxkBpC69DT8Mw1bcuKPotz ogfEkfAjBZz8hTmaox7GVEeCavNTZLSRpwg0FDuodlPHhzK3bV7c7M2PD+8vPFy6BN4F s0eFGaH6ZO8UzG5SxzpMssyw6y+RZHsvqtHy09nNzclkOR7bNF3ZY2VuUpZsCuvgk1Oe AAdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=FKPhVy8yJfSLgPgkej4EpUMhrMyswlzqeuoXzSu+/lw=; b=TuX0Z4ewCGe/XwIvZfbQjusesInlW2wUjYkPNFOZpmLXVX8YM/pth9yOBRvc+UIiRi RY1+8LihLDPHi9aYpN5grn9DLM/O8DAc2fC8K48aDS2065Nr/lvgkkqhFAEvLu3ZWkmv gaUvRGDvMWI31KNA27jtuf1fKdEd6LFozVF5cK6PPOLrSLaB0Yb0engB8ZVPMgx/yN1R gh3nuNxgDilN56FoebhSZK0U6u4rL7OvCVuw7zDnw71Z3+zzFG3BiF0j6UbK7UTAlW74 S7RvlNTZzMtfsOPyK290UkwE5znbvpHy4mIQexWm1ZDtB9E2xA8eLpXZ+9XRhpw35vSK PKPw== 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 f24si9150963pgi.289.2019.06.10.00.37.37; Mon, 10 Jun 2019 00:37:52 -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 S2388105AbfFJHhM (ORCPT + 99 others); Mon, 10 Jun 2019 03:37:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34732 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388000AbfFJHhL (ORCPT ); Mon, 10 Jun 2019 03:37:11 -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 76FD97FDEE; Mon, 10 Jun 2019 07:37:11 +0000 (UTC) Received: from kasong-rh-laptop.pek2.redhat.com (wlc-trust-16.pek2.redhat.com [10.72.3.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70DA960565; Mon, 10 Jun 2019 07:37:04 +0000 (UTC) From: Kairui Song To: linux-kernel@vger.kernel.org, Borislav Petkov , Baoquan He , Junichi Nomura , Dave Young Cc: Dirk van der Merwe , Chao Fan , Ingo Molnar , "Rafael J. Wysocki" , Thomas Gleixner , x86@kernel.org, kexec@lists.infradead.org, Kairui Song Subject: [PATCH] x86/kexec: Add ACPI NVS region to the ident map Date: Mon, 10 Jun 2019 15:36:17 +0800 Message-Id: <20190610073617.19767-1-kasong@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.27]); Mon, 10 Jun 2019 07:37:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the recent addition of RSDP parsing in decompression stage, kexec kernel now needs ACPI tables to be covered by the identity mapping. And in commit 6bbeb276b71f ("x86/kexec: Add the EFI system tables and ACPI tables to the ident map"), ACPI tables memory region was added to the ident map. But on some machines, there is only ACPI NVS memory region, and the ACPI tables is located in the NVS region instead. In such case second kernel will still fail when trying to access ACPI tables. So, to fix the problem, add NVS memory region in the ident map as well. Fixes: 6bbeb276b71f ("x86/kexec: Add the EFI system tables and ACPI tables to the ident map") Suggested-by: Junichi Nomura Signed-off-by: Kairui Song --- Tested with my laptop and VM, on top of current tip:x86/boot. arch/x86/kernel/machine_kexec_64.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 3c77bdf7b32a..a406602fdb3c 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -54,14 +54,26 @@ static int mem_region_callback(struct resource *res, void *arg) static int map_acpi_tables(struct x86_mapping_info *info, pgd_t *level4p) { - unsigned long flags = IORESOURCE_MEM | IORESOURCE_BUSY; + int ret; + unsigned long flags; struct init_pgtable_data data; data.info = info; data.level4p = level4p; flags = IORESOURCE_MEM | IORESOURCE_BUSY; - return walk_iomem_res_desc(IORES_DESC_ACPI_TABLES, flags, 0, -1, - &data, mem_region_callback); + + ret = walk_iomem_res_desc(IORES_DESC_ACPI_TABLES, flags, 0, -1, + &data, mem_region_callback); + if (ret && ret != -EINVAL) + return ret; + + /* ACPI tables could be located in ACPI Non-volatile Storage region */ + ret = walk_iomem_res_desc(IORES_DESC_ACPI_NV_STORAGE, flags, 0, -1, + &data, mem_region_callback); + if (ret && ret != -EINVAL) + return ret; + + return 0; } #else static int map_acpi_tables(struct x86_mapping_info *info, pgd_t *level4p) { return 0; } -- 2.21.0