Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3602933ybi; Mon, 10 Jun 2019 13:10:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsYznEKoqUN61a/z9hAf+umSOj6dng9jBzrLJGSZay1D+hnP9L+OOLDblK8i/v94hEpQuW X-Received: by 2002:a62:585:: with SMTP id 127mr74292386pff.231.1560197451347; Mon, 10 Jun 2019 13:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560197451; cv=none; d=google.com; s=arc-20160816; b=StkML29ddfJYR0uAGkJXf0eF8HDcWtMLj3eb9HjGQSclGvmqDHgyU6FjilOyO0AlpH /xozKIPBW1rd15DxIzDzsd/ZBKKibZ5ifnqugVTrp3UyNgKOwh0XJJzMhyeGAotWAbyl kEag2hyhhZUxW+Z5p01SGKUDdTXm1Be50nuiTUQPi2A/Es+HEmJGVANzevNQkgEfmMCo sjny2rZsr0YrmCIzOtt2MJG7yAtA6BVtH36yBXm8wOD++ejaINCylyfqpOh4Ga6V/h4Y Nj2nAJdNqipoQx7yyxPKy7vR+rettGLX1b0ZtVjuaZZh4RF0IWoqCVjHVPAHEMviUJxP IwZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=8CH7/Z39abKKy8RxsnD113lmL8hqQ7iG7mCzh9v8ZA0=; b=VDK4CNWp4vDJR0pTolIncWK88eHpLV9t2FfzmBuewPMVqMeoH73+y6JG+XQ2IIf0oG 7pr0ZOZ0foskieMQe3UPNilb253cX/qipo971N0r6TZXINZThWwoIGKOwOP6b96WSF5Q 4veOFNt2RoEgptMN0aJJOb1QOPKNoi9f0f354hF26HBUm3p1S+vT6nzuRa9uP/SA9ld6 QV+pf0QN2v55y3VC5CA4qhVhaBAyma/F8JnrqbITiw6vdFX1mqGaYCv/NWReeJDrXTsb uhdDaO2CZ4jyHHm/Z91wextr6KWSVzr3WsxeCFxFT524wzyC4uXCUNO2ZyL+DP6e+p/X 6/yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019051801 header.b="CHzp2/jM"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r130si10502677pgr.509.2019.06.10.13.10.35; Mon, 10 Jun 2019 13:10:51 -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; dkim=pass header.i=@zytor.com header.s=2019051801 header.b="CHzp2/jM"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389439AbfFJUJe (ORCPT + 99 others); Mon, 10 Jun 2019 16:09:34 -0400 Received: from terminus.zytor.com ([198.137.202.136]:56797 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389099AbfFJUJd (ORCPT ); Mon, 10 Jun 2019 16:09:33 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x5AK80w34057172 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 10 Jun 2019 13:08:00 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x5AK80w34057172 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019051801; t=1560197281; bh=8CH7/Z39abKKy8RxsnD113lmL8hqQ7iG7mCzh9v8ZA0=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=CHzp2/jMzL+O+QKahhWaAReCCbdOR4iL1hk7If1xKZQEqSI9A6OsLL/NPV27dCZlB MEUur3Yx6SgOmihSRCTMZJJSJAl3Gf5TsS5YHQ2tsARPYsuw5aFs6JM9pnBztD7f4n gt20VnH9KeBQo+sNiGkFn3lHGy6mLaQ278J0etQQjzEnmuuq4QJaF368xx/gtDAi/A 0rhZynrE69CMC2p9Ewk+K1manBlUw+er0QN38nz7MFLT4j9O2y79ks6VxlOySs/ncI pemNtM/ufSmesXncrZk/3PyMz+gr5lQHRMFPDRT2pLjKX30Cm1Np+AcMXTxaKa0jOX 6yrub/9PjFTjg== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x5AK7xvJ4057162; Mon, 10 Jun 2019 13:07:59 -0700 Date: Mon, 10 Jun 2019 13:07:59 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Kairui Song Message-ID: Cc: rjw@rjwysocki.net, bp@suse.de, dyoung@redhat.com, j-nomura@ce.jp.nec.com, linux-kernel@vger.kernel.org, kasong@redhat.com, x86@kernel.org, mingo@kernel.org, fanc.fnst@cn.fujitsu.com, tglx@linutronix.de, lijiang@redhat.com, bhe@redhat.com, dirk.vandermerwe@netronome.com, hpa@zytor.com Reply-To: hpa@zytor.com, dirk.vandermerwe@netronome.com, bhe@redhat.com, lijiang@redhat.com, tglx@linutronix.de, fanc.fnst@cn.fujitsu.com, mingo@kernel.org, kasong@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, dyoung@redhat.com, j-nomura@ce.jp.nec.com, bp@suse.de, rjw@rjwysocki.net In-Reply-To: <20190610073617.19767-1-kasong@redhat.com> References: <20190610073617.19767-1-kasong@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/boot] x86/kexec: Add the ACPI NVS region to the ident map Git-Commit-ID: 5a949b38839e284b1307540c56b03caf57da9736 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 5a949b38839e284b1307540c56b03caf57da9736 Gitweb: https://git.kernel.org/tip/5a949b38839e284b1307540c56b03caf57da9736 Author: Kairui Song AuthorDate: Mon, 10 Jun 2019 15:36:17 +0800 Committer: Borislav Petkov CommitDate: Mon, 10 Jun 2019 22:00:26 +0200 x86/kexec: Add the ACPI NVS region to the ident map With the recent addition of RSDP parsing in the decompression stage, a kexec-ed 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") the ACPI tables memory region was added to the ident map. But some machines have only an ACPI NVS memory region and the ACPI tables are located in that region. In such case, the kexec-ed kernel will still fail when trying to access ACPI tables if they're not mapped. So add the NVS memory region to the ident map as well. [ bp: Massage. ] 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 Signed-off-by: Borislav Petkov Tested-by: Junichi Nomura Cc: Baoquan He Cc: Chao Fan Cc: Dave Young Cc: Dirk van der Merwe Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: kexec@lists.infradead.org Cc: Lianbo Jiang Cc: "Rafael J. Wysocki" Cc: Thomas Gleixner Cc: x86-ml Link: https://lkml.kernel.org/r/20190610073617.19767-1-kasong@redhat.com --- 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..b2b88dcaaf88 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; struct init_pgtable_data data; + unsigned long flags; + int ret; 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; }