Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4726670imm; Mon, 14 May 2018 11:56:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqLLZBdUj68aFoYVSD46SkscykZY9a0eQ4P8ZO72pza90wr7Oo92C+aLrnB5Tj+NNhg3Qf+ X-Received: by 2002:a17:902:8602:: with SMTP id f2-v6mr10935443plo.5.1526324214431; Mon, 14 May 2018 11:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526324214; cv=none; d=google.com; s=arc-20160816; b=xR/amEMxk/LYlUy2NLk9L1IUDj4IZ/8wmb+e+kRuQ+9tO0Nnls7VRUi1phTJYLggnm lqGm2gCZNcRLvag5Lm+EN3ZQXHjMKNAgh4Jn0J6K1z38neZluQVua43APKGrYXzeCxYy AppEcbJ2ycfFR6fDGzojbD2YXl2VPkrOo1ntQxCHqSt7He9zCpD/4a+j86y/C9kZuYTm NVaKgrk8N6xAAfWrqPT3l4SSBxziZww8Td+BtTdCrVbe6Kx4R/rbGttRvloWmhfgXDwu r0qHsBpLB819+hWrOvWwa08Rg0mb0j2CFBi32ahnUzDNP3iDz1toEOCj3iKgYljnDcMM QUNQ== 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:arc-authentication-results; bh=qDE2k93vdOZ6heqADRSrtjwWKHthVUBiCF3xPit8tR0=; b=kyJLY1YKG5GjPIVLpPW859R635orNC0mrRUBShGexMhQJx4Wm9TrqZf8FNCN08RW3f CofraCzMIhrgd5zKfzgqcfiUgRSdD1Eb39PpEA8WrJAIFooXiadSxXLazKpyK9DGaz9M BAymJpWR41VLE7BvBVXErqJuWlpZLso1piqpUhOfxL3BRDcE0xieb/vjURFuO2vunCyU L7fZDYIpjcjX9rgh2d6cdc2wAz70ILnebEvMGQAZI2gdBeX76hqmAr/2o9nIUJAUuNor 06G+uwTvOJ0/sNJs9fwyjofVhQvh0FKDZeSKzL1AX0mYQ+GW9I90TuVknOcwEdSjoijb B8sg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az5-v6si10119522plb.369.2018.05.14.11.56.40; Mon, 14 May 2018 11:56:54 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752403AbeENSzJ (ORCPT + 99 others); Mon, 14 May 2018 14:55:09 -0400 Received: from mga02.intel.com ([134.134.136.20]:45332 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752013AbeENSwa (ORCPT ); Mon, 14 May 2018 14:52:30 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2018 11:52:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,401,1520924400"; d="scan'208";a="39244644" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga007.fm.intel.com with ESMTP; 14 May 2018 11:52:28 -0700 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "H. Peter Anvin" , "Ashok Raj" , "Ravi V Shankar" , "Tony Luck" , "Dave Hansen" , "Rafael Wysocki" , "Arjan van de Ven" , "Alan Cox" Cc: "x86" , "linux-kernel" , Fenghua Yu Subject: [PATCH 08/15] x86/split_lock: Set split lock during EFI runtime service Date: Mon, 14 May 2018 11:52:18 -0700 Message-Id: <1526323945-211107-9-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1526323945-211107-1-git-send-email-fenghua.yu@intel.com> References: <1526323945-211107-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If kernel enables #AC for split locked accesses, EFI runtime service may hit #AC exception, treat it as fatal fault, and cause system hang. To avoid debugging potential buggy EFI runtime service code in BIOS, restore to BIOS split lock setting before entering EFI runtime service and restore to kernel split lock setting after exiting EFI runtime service. Signed-off-by: Fenghua Yu --- arch/x86/include/asm/efi.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index cec5fae23eb3..6dcd0717a3cf 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -8,6 +8,7 @@ #include #include #include +#include /* * We map the EFI regions needed for runtime services non-contiguously, @@ -41,12 +42,14 @@ extern asmlinkage unsigned long efi_call_phys(void *, ...); #define arch_efi_call_virt_setup() \ ({ \ kernel_fpu_begin(); \ + restore_split_lock_ac_bios(NULL); \ firmware_restrict_branch_speculation_start(); \ }) #define arch_efi_call_virt_teardown() \ ({ \ firmware_restrict_branch_speculation_end(); \ + restore_split_lock_ac_kernel(NULL); \ kernel_fpu_end(); \ }) @@ -84,6 +87,7 @@ struct efi_scratch { efi_sync_low_kernel_mappings(); \ preempt_disable(); \ __kernel_fpu_begin(); \ + restore_split_lock_ac_bios(NULL); \ firmware_restrict_branch_speculation_start(); \ \ if (!efi_enabled(EFI_OLD_MEMMAP)) \ @@ -99,6 +103,7 @@ struct efi_scratch { efi_switch_mm(efi_scratch.prev_mm); \ \ firmware_restrict_branch_speculation_end(); \ + restore_split_lock_ac_kernel(NULL); \ __kernel_fpu_end(); \ preempt_enable(); \ }) -- 2.5.0