Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp72128pxa; Wed, 26 Aug 2020 05:12:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSV2hqJ5btWmbeRpAKnAlqiri5aLU6Cg923kxtYsNE/ZW04wDOHDhtMeoQhNZX+YTfys5A X-Received: by 2002:a05:6402:b35:: with SMTP id bo21mr5735751edb.99.1598443959929; Wed, 26 Aug 2020 05:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598443959; cv=none; d=google.com; s=arc-20160816; b=QhTO4BRC4H+jnSocvneS+fNjhnhm0vktv0lMeArmEI85ySh7pa0xuz05kuZDEw5ZoB IvHykbXH6CKPtydbEf8RtuTJ++AT/2q/RKNqwNdTlMWegd0TflLFFInAu3u6zzOFeoiK YJn8H0yH7jIkymPda50FG92rgxK6Hlf5y7gD7oOTI5W+RtpljLubg7WQkjt9Vaoc7yf3 Q2SGdUdZDfz/WHQdZ4UpJz8GefcfTAr/Z+D43ypRVgJdyeHXUvACiEBXAeSXp8mDrwRh GGq9KDLeQpG8oHe5dWqNKv9Eayn3tIBpaUQ92ATsKF5B+51mdRZNVsnEhhJ7LKRCYYQP lZEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6DObhuIRmY64gOPDSeW2ROL2s66seKqH13RtukGJ8l8=; b=hH6ECSNh9m52DM91W/X2CTtv72eoVnektYIdZtV5VfFCJjsgP7Zw6oXySCSQ1JmVub NyVpkv1iEmwGydw5WU2XonApgbydaELsdler18Lqz13R5st3FX9GCy0WFon4i+GiXEnO IqBpkZbVKhhxnglsu1Fki+TL/ep0uCOB186mUqdxOH2QKqnSBcyzYe8R8Ym0ZPnGccEU RGnNhrYTrUyuIGcX0zfaVOIQguzcg8bjdAXN9oOizl+20020jYLodIUg4IRvhmQzanq5 R8g59ANkJDcWKApjWGhKhRpGE7S2pdweRTn8Hw29XLAFGjwkKLW5r1MOxeRaSVMaTKRC UvCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EKwiHOBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si1244296edv.593.2020.08.26.05.12.15; Wed, 26 Aug 2020 05:12:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EKwiHOBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729458AbgHZMIi (ORCPT + 99 others); Wed, 26 Aug 2020 08:08:38 -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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 >