Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1515990imm; Sun, 27 May 2018 08:50:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpjVVOprGceKRr/LnH0OmAFaOpELa/Cb9D2urkHkSMJJsYzpaYtiJDWQMEywAsvBG3hTae8 X-Received: by 2002:a62:d653:: with SMTP id r80-v6mr9026406pfg.54.1527436228472; Sun, 27 May 2018 08:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527436228; cv=none; d=google.com; s=arc-20160816; b=AqTevCwdr5QBaUs2GU0HsxJGgqNJ0r4mGX30jp1b+DEEI54WZVCs3xRwH7uwsji/E/ mO6oghsz9iS/s5IMBRmlKwA9FozkL9YaGnw85XnRQjrLEAn9Hu1npEYF9TaE0kKqU11x W+yub3GUKdcfu11cLrvkpyFxNPIryoPHHZOQwSxJVlnMVBK2G2D0n+DPc9gwHPBeLIHp gBBF9T7/3xirEFODMuPBR0aKicG6kdMdckuJNTBJWuDfmow81dGWDR8EFGnY009/k0mh r8f3JZY7V3ZPVNk3XP+LMSBzCPpHgJcX6vcEyV1ML9alTBgH7cjT0zeox90pv38b+zKL M8WQ== 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=hQ6q4Rz/5kiwuTDvQhhhE2bbKGW9XbMUTtIT8Lzqrlw=; b=p3xSo2G4u9252jRU6Y/ApWOcbXgIQvlblTQmGWbyUc9l7C6OjSnaArYyh2FHxLNaJA aewHTDqzjmF27b09EA936EhndVg7GVhzbJJdywWyG9lHD5uRsRiKWhF9IpZfIF7rq1Be nRapBzMNQueEwpQ62J4eJS1XdawvIz3vyuKKI2Vukc9T7d9afjnA3TKpSk0nufPd8Rye 9Aq6iYPdWG0JsQX+Ejc+okRWTSoSABRd7zpAQpn+VDsrYizI4IsQisWHP3gZGKe62fWu 6I16W65bJ+ksPi8wSaVkos5g4LHOr16lH5oapo+a1vYxQjp5WTrN7yDD6kjTdf+7f+C2 0rkg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17-v6si6785746pgw.440.2018.05.27.08.50.14; Sun, 27 May 2018 08:50: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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033129AbeE0PtT (ORCPT + 99 others); Sun, 27 May 2018 11:49:19 -0400 Received: from mga02.intel.com ([134.134.136.20]:28379 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032787AbeE0PqT (ORCPT ); Sun, 27 May 2018 11:46:19 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 May 2018 08:46:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,448,1520924400"; d="scan'208";a="227741087" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by orsmga005.jf.intel.com with ESMTP; 27 May 2018 08:46:14 -0700 From: Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "H. Peter Anvin" Cc: "Ashok Raj" , "Dave Hansen" , "Rafael Wysocki" , "Tony Luck" , "Alan Cox" , "Ravi V Shankar" , "Arjan van de Ven" , "linux-kernel" , "x86" , Fenghua Yu Subject: [RFC PATCH 08/16] x86/split_lock: Set split lock during EFI runtime service Date: Sun, 27 May 2018 08:45:57 -0700 Message-Id: <1527435965-202085-9-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1527435965-202085-1-git-send-email-fenghua.yu@intel.com> References: <1527435965-202085-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 firmware, restore to firmware 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..a5604e5a56c1 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_firmware(); \ firmware_restrict_branch_speculation_start(); \ }) #define arch_efi_call_virt_teardown() \ ({ \ firmware_restrict_branch_speculation_end(); \ + restore_split_lock_ac_kernel(); \ kernel_fpu_end(); \ }) @@ -84,6 +87,7 @@ struct efi_scratch { efi_sync_low_kernel_mappings(); \ preempt_disable(); \ __kernel_fpu_begin(); \ + restore_split_lock_ac_firmware(); \ 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(); \ __kernel_fpu_end(); \ preempt_enable(); \ }) -- 2.5.0