Received: by 10.223.185.116 with SMTP id b49csp2226463wrg; Sat, 24 Feb 2018 14:19:31 -0800 (PST) X-Google-Smtp-Source: AH8x2276l7Ifh2X5CRFWPxJY9fM2O470Sp9BBYrnXtRRXNFu1fl9wXOpZElk3is/DYglZ91cOw04 X-Received: by 2002:a17:902:b901:: with SMTP id bf1-v6mr6005064plb.175.1519510771030; Sat, 24 Feb 2018 14:19:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519510770; cv=none; d=google.com; s=arc-20160816; b=eSDF9J2vwAhz437MJkW9Hjsbl+sANkXamW/xSytFJJp77sDV0GcKq530kKCe4M3OUN pePsVbD/UaTKMdC4mtcPfzPaTP+ORkCZv2A3rCXyf3hAOuwEBiCc8ceyYgUXnYF/30uY yWkN/VV/AZWRi5um4N9f6204eOrcWXifEaBSAn/tyVlcJpm/4xWO73K4SNGWh2gthlyT uCQ/71rWc9WI06Bn/zAPUhlDzMRTWEjIEc6IPwbCxz/APIXEN7E7x4bcXVPOxUfv61Nx dh8pjDM1tq6MvIMw+u0hD/O+dJH/QEcGKgK4YVy4mElJYG8oawPGU65tU5Fp4VOzM274 tJDQ== 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=jzk5KebLKqQjdsL4jx8Dmc3mG5lwgbbeFByXJxzrlUk=; b=UTUCJbv2E1kiVaLlR0G4zSwUIa5QLX9uRf+guH+iJcsWMZHUtX1lpe6BsquwcvJYI/ v8yzw5/SJCP27EYt1a99xK7xdS/GCgfQ+C8QfC0RYc09jZ+qri37N+ChULe0l5tj1DgY s5d/6GXlGzQ+hw7bbS7AzlPpOg+KzEuS6iH4PJJQ1cn/mmu1GJ+rmu1ZESyJTYRQVohe Msxp61H8IB+7vOcE6q9zVBJbKXgBdzhF54rD2eWM8pSqpxSFU+9qUSB5hVlQSaF1PR7x ornUJC1PD7ktLQUUx0wZnp6oYhF53ime/M/wQssgIhsZhWWcLlkW0vM/MdBV7Ej3/fEl TQew== 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 72-v6si4187684ple.299.2018.02.24.14.19.17; Sat, 24 Feb 2018 14:19:30 -0800 (PST) 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 S1751608AbeBXWRe (ORCPT + 99 others); Sat, 24 Feb 2018 17:17:34 -0500 Received: from mga04.intel.com ([192.55.52.120]:23057 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751567AbeBXWRb (ORCPT ); Sat, 24 Feb 2018 17:17:31 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2018 14:17:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,389,1515484800"; d="scan'208";a="20564912" Received: from saipraneeth.sc.intel.com ([143.183.140.145]) by orsmga008.jf.intel.com with ESMTP; 24 Feb 2018 14:17:30 -0800 From: Sai Praneeth Prakhya To: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sai Praneeth , "Lee, Chun-Yi" , Borislav Petkov , Tony Luck , Will Deacon , Dave Hansen , Mark Rutland , Bhupesh Sharma , Ricardo Neri , Ravi Shankar , Matt Fleming , Peter Zijlstra , Ard Biesheuvel , Dan Williams Subject: [PATCH V1 1/3] x86/efi: Call efi_delete_dummy_variable() during efi subsystem initialization Date: Sat, 24 Feb 2018 14:10:47 -0800 Message-Id: <1519510249-31447-2-git-send-email-sai.praneeth.prakhya@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1519510249-31447-1-git-send-email-sai.praneeth.prakhya@intel.com> References: <1519510249-31447-1-git-send-email-sai.praneeth.prakhya@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sai Praneeth Invoking efi_runtime_services() through efi_workqueue means all accesses to efi_runtime_services() should be done after efi_rts_wq has been created. efi_delete_dummy_variable() calls set_variable(), hence efi_delete_dummy_variable() should be called after efi_rts_wq has been created. efi_delete_dummy_variable() is called from efi_enter_virtual_mode() which is early in the boot phase (efi_rts_wq isn't created yet), so call efi_delete_dummy_variable() later in the boot phase i.e. while initializing efi subsystem. In the next patch, this is the place where we create efi_rts_wq and all the efi_runtime_services() will be called using efi_rts_wq. Signed-off-by: Sai Praneeth Prakhya Suggested-by: Andy Lutomirski Cc: Lee, Chun-Yi Cc: Borislav Petkov Cc: Tony Luck Cc: Will Deacon Cc: Dave Hansen Cc: Mark Rutland Cc: Bhupesh Sharma Cc: Ricardo Neri Cc: Ravi Shankar Cc: Matt Fleming Cc: Peter Zijlstra Cc: Ard Biesheuvel Cc: Dan Williams --- arch/x86/include/asm/efi.h | 1 - arch/x86/platform/efi/efi.c | 6 ------ drivers/firmware/efi/efi.c | 7 +++++++ include/linux/efi.h | 3 +++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 85f6ccb80b91..34b03440a80f 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -130,7 +130,6 @@ extern void __init efi_runtime_update_mappings(void); extern void __init efi_dump_pagetable(void); extern void __init efi_apply_memmap_quirks(void); extern int __init efi_reuse_config(u64 tables, int nr_tables); -extern void efi_delete_dummy_variable(void); struct efi_setup_data { u64 fw_vendor; diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 9061babfbc83..a3169d14583f 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -893,9 +893,6 @@ static void __init kexec_enter_virtual_mode(void) if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX)) runtime_code_page_mkexec(); - - /* clean DUMMY object */ - efi_delete_dummy_variable(); #endif } @@ -1015,9 +1012,6 @@ static void __init __efi_enter_virtual_mode(void) * necessary relocation fixups for the new virtual addresses. */ efi_runtime_update_mappings(); - - /* clean DUMMY object */ - efi_delete_dummy_variable(); } void __init efi_enter_virtual_mode(void) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index cd42f66a7c85..ac5db5f8dbbf 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -33,6 +33,7 @@ #include #include +#include struct efi __read_mostly efi = { .mps = EFI_INVALID_TABLE_ADDR, @@ -328,6 +329,12 @@ static int __init efisubsys_init(void) if (!efi_enabled(EFI_BOOT)) return 0; + /* + * Clean DUMMY object calls EFI Runtime Service, set_variable(), so + * it should be invoked only after efi_rts_workqueue is ready. + */ + efi_delete_dummy_variable(); + /* We register the efi directory at /sys/firmware/efi */ efi_kobj = kobject_create_and_add("efi", firmware_kobj); if (!efi_kobj) { diff --git a/include/linux/efi.h b/include/linux/efi.h index f5083aa72eae..c4efb3ef0dfa 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -992,6 +992,7 @@ extern efi_status_t efi_query_variable_store(u32 attributes, unsigned long size, bool nonblocking); extern void efi_find_mirror(void); +extern void efi_delete_dummy_variable(void); #else static inline void efi_late_init(void) {} static inline void efi_free_boot_services(void) {} @@ -1002,6 +1003,8 @@ static inline efi_status_t efi_query_variable_store(u32 attributes, { return EFI_SUCCESS; } + +static inline void efi_delete_dummy_variable(void) {} #endif extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr); -- 2.1.4