From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1AADC433E1 for ; Wed, 26 Aug 2020 12:08:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DDA220838 for ; Wed, 26 Aug 2020 12:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598443718; bh=LtLkAShyIGY4PhKwW6il8v3zv5EU8NYcrikGnC+ntT8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=o+RWbRyrHRyB4Hv8Sfmc5pq5o1GV50/CVhM7SvdxOdTziNei/OMqc2I969eUS14bv b7A8FPgkdhNmi9WhbDQpHZSMXdMqVlY7PMrU0c9t4F1tPFLeRrlo0DECqLTaQ16ox/ 1aUSjceDEMBAxcGubufzmEw0SRmoW5FgQ/WUUnOI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729645AbgHZMIf (ORCPT ); Wed, 26 Aug 2020 08:08:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:44992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729789AbgHZMIa (ORCPT ); Wed, 26 Aug 2020 08:08:30 -0400 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6970E2087D; Wed, 26 Aug 2020 12:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598443709; bh=LtLkAShyIGY4PhKwW6il8v3zv5EU8NYcrikGnC+ntT8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=EKwiHOBEcwfHi77g0MzNXWtK1Ubhlp/WdnhtS9QSltgfUUVtCqPX+wWO7UTLIcPcF iwrC9pggBzskvCXX0z7cnUC33cQExDdltwfXMKKx+VHp/xP88/JiG+qLhrNinKTR1L 0Kev3G/OZaHrJhJALb3DZAPUCuh3SLHyULX+LNNc= Received: by mail-oi1-f170.google.com with SMTP id v13so1258592oiv.13; Wed, 26 Aug 2020 05:08:29 -0700 (PDT) X-Gm-Message-State: AOAM531ieJPET8RF0oRAA9Wni6w2msMK1zSbsNdVjKqqW1DNW06IqeZe 50R0CZux2jBQyuVGj+5oGu1ehGSILgndM28EG3o= X-Google-Smtp-Source: ABdhPJzzPq7S2H5rVGigyuue4pj1WV/eBXdUGRHi6dgNXRlZ8nZgWnELoCz7uNsTVW4mTpQmfHxfC71nLK9ZQYuGbc8= X-Received: by 2002:aca:d8c5:: with SMTP id p188mr3452457oig.47.1598443708834; Wed, 26 Aug 2020 05:08:28 -0700 (PDT) MIME-Version: 1.0 References: <20200826004607.7483-1-jlee@suse.com> In-Reply-To: <20200826004607.7483-1-jlee@suse.com> From: Ard Biesheuvel Date: Wed, 26 Aug 2020 14:08:18 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] efi/efivars: Create efivars mount point via efivars abstraction To: "Lee, Chun-Yi" Cc: Ard Biesheuvel , linux-efi , Linux Kernel Mailing List , "Lee, Chun-Yi" , Matthias Brugger , Fabian Vogt , Ilias Apalodimas Content-Type: text/plain; charset="UTF-8" Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On Wed, 26 Aug 2020 at 02:46, Lee, Chun-Yi wrote: > > This patch creates efivars mount point when active efivars abstraction > be set. It is useful for userland to determine the availability of efivars > filesystem. > > Cc: Matthias Brugger > Cc: Fabian Vogt > Cc: Ilias Apalodimas > Cc: Ard Biesheuvel > Signed-off-by: "Lee, Chun-Yi" Apologies for not bringing this up before: while the patch seems fine, I wonder if we really need this if the purpose is to decide whether efivars is available or not. We already have the 'efivars' platform device for this, and so userland can simply check for the existence of /sys/devices/platform/efivars.0 and so we don't need to make any changes for this. > --- > > v2: > Using efivars_kobject() helper instead of checking GetVariable or > GetNextVariable EFI runtime services. Because the efivarfs code could be > instantiated using a different efivars abstraction. > > drivers/firmware/efi/efi.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c > index 3aa07c3b5136..db483fc68501 100644 > --- a/drivers/firmware/efi/efi.c > +++ b/drivers/firmware/efi/efi.c > @@ -405,11 +405,13 @@ static int __init efisubsys_init(void) > if (error) > goto err_remove_group; > > - /* and the standard mountpoint for efivarfs */ > - error = sysfs_create_mount_point(efi_kobj, "efivars"); > - if (error) { > - pr_err("efivars: Subsystem registration failed.\n"); > - goto err_remove_group; > + if (efivars_kobject()) { > + /* and the standard mountpoint for efivarfs */ > + error = sysfs_create_mount_point(efi_kobj, "efivars"); > + if (error) { > + pr_err("efivars: Subsystem registration failed.\n"); > + goto err_remove_group; > + } > } > > if (efi_enabled(EFI_DBG) && efi_enabled(EFI_PRESERVE_BS_REGIONS)) > -- > 2.16.4 >