From patchwork Tue May 17 15:34:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 573559 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C40ECC433FE for ; Tue, 17 May 2022 15:36:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347265AbiEQPgi (ORCPT ); Tue, 17 May 2022 11:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350287AbiEQPfY (ORCPT ); Tue, 17 May 2022 11:35:24 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 482694F9E4; Tue, 17 May 2022 08:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652801723; x=1684337723; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xF84dLhyksFpMyCb7NPvfM3NGwTlY5bjd8sAol6pl90=; b=TMYtVfDZgaBZGMHR8c6G5saRyd6A//WHxkW6YdnM+feS8lxIoVvUFkln bhOqBajPGLii3l5RapKBm+YZMOeXu1Wzzvy6EjUzUiRHCMT2iWXi4eH28 ZQjq5Ggz426zmgCXIzns5i1p1tl3QvPwiwKC71hS14lrV1oU5ghhf5CjI 97zVgCm83npGSh45rMVVOxgwvj7jOfklyYD9ka7Ye3Lg1ptTvOc6C3uyF 2Mr8ltkxgme92WASguTm3+czpk9H5+h2zovznMkEDKlpFGsDOiC11ByLr R6VVoegZbEwm9GKuB8Ta6FU1v+BjuJQgbFv4grr0zp2D3q8ZCU9USYS6U Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="253270625" X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="253270625" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 08:35:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="555823109" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 17 May 2022 08:34:58 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id CBC23D38; Tue, 17 May 2022 18:34:50 +0300 (EEST) From: "Kirill A. Shutemov" To: Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Dave Hansen , Mike Rapoport , David Hildenbrand , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv6 11/15] x86: Disable kexec if system has unaccepted memory Date: Tue, 17 May 2022 18:34:40 +0300 Message-Id: <20220517153444.11195-12-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> References: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On kexec, the target kernel has to know what memory has been accepted. Information in EFI map is out of date and cannot be used. boot_params.unaccepted_memory can be used to pass the bitmap between two kernels on kexec, but the use-case is not yet implemented. Disable kexec on machines with unaccepted memory for now. Signed-off-by: Kirill A. Shutemov --- arch/x86/mm/unaccepted_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/mm/unaccepted_memory.c b/arch/x86/mm/unaccepted_memory.c index 1ca71eb98c24..b4c43e6089b0 100644 --- a/arch/x86/mm/unaccepted_memory.c +++ b/arch/x86/mm/unaccepted_memory.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only +#include #include #include #include @@ -114,6 +115,15 @@ static int __init unaccepted_init(void) if (!boot_params.unaccepted_memory) return 0; +#ifdef CONFIG_KEXEC_CORE + /* + * TODO: Information on memory acceptance status has to be communicated + * between kernel. + */ + pr_warn("Disable kexec: not yet supported on systems with unaccepted memory\n"); + kexec_load_disabled = 1; +#endif + bitmap_size = e820__end_of_ram_pfn() * PAGE_SIZE / PMD_SIZE; unaccepted_memory = __va(boot_params.unaccepted_memory);