Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751158AbbD3JTu (ORCPT ); Thu, 30 Apr 2015 05:19:50 -0400 Received: from mga11.intel.com ([192.55.52.93]:37406 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750730AbbD3JTp (ORCPT ); Thu, 30 Apr 2015 05:19:45 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,675,1422950400"; d="scan'208";a="721523845" From: "Kweh, Hock Leong" To: Andy Lutomirski CC: James Bottomley , Peter Jones , Greg Kroah-Hartman , "Matt Fleming" , Ming Lei , "Ong, Boon Leong" , LKML , "linux-efi@vger.kernel.org" , Sam Protsenko , "Roy Franz" , Borislav Petkov , Al Viro , Linux FS Devel Subject: RE: [PATCH v4 2/2] efi: an sysfs interface for user to update efi firmware Thread-Topic: [PATCH v4 2/2] efi: an sysfs interface for user to update efi firmware Thread-Index: AQHQdrzO9Y2+ZGg6U0KLDsR6juvZY51N4NhA//+pEQCAAVzbQIAB0EYAgAANNQCAA67xIIABCe6AgAE5nKCAAlwLZf//mNaAgAGjweD//9tdgAApwlLAAMCYZ7f//4PQAIAAAVwAgAADMAD//bUgoIAFKWsA//7y/zA= Date: Thu, 30 Apr 2015 09:17:54 +0000 Message-ID: References: <20150415131906.GC21491@kroah.com> <20150417134924.GB19794@kroah.com> <20150417143640.GB3671@codeblueprint.co.uk> <20150420144323.GA7261@kroah.com> <20150421075620.GA11000@kroah.com> <1429665679.2207.44.camel@HansenPartnership.com> <20150422132734.GB12062@redhat.com> <1429715913.2195.22.camel@HansenPartnership.com> <1429798187.2170.3.camel@HansenPartnership.com> <1429888575.2182.20.camel@HansenPartnership.com> <1430174136.2314.49.camel@HansenPartnership.com> <1430175112.2314.56.camel@HansenPartnership.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.30.20.206] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t3U9JunR032029 Content-Length: 2967 Lines: 79 > -----Original Message----- > From: Andy Lutomirski [mailto:luto@amacapital.net] > Sent: Thursday, April 30, 2015 2:41 AM > > On Wed, Apr 29, 2015 at 4:23 AM, Kweh, Hock Leong > wrote: > > > > Dear communities, > > > > I agree with James. Due to different people may have different needs. > > But from our side, we would just like to have a simple interface for > > us to upload the efi capsule and perform update. We do not have any > > use case or need to get info from QueryCapsuleUpdate(). Let me give a > suggestion here: > > please allow me to focus on deliver this simple loading interface and > > upstream it. Then later whoever has the actual use case or needs on > > the ioctl implementation, he or she could enhance base on this simple > loading interface. > > What do you guys think? > > > > Let me summarize the latest design idea: > > - No longer leverage on firmware class but use misc device > > - Do not use platform device but use device_create() > > - User just need to perform "cat file.bin > /sys/.../capsule_loader" > > in the shell > > If you do this, there's no need for the misc device. I do this so that in the future when someone want to implement the Ioctl(), he or she can base on this and expand it. > > > - File operation functions include: open(), read(), write() and > > flush() > > - Perform mutex lock in open() then release the mutex in flush() for > avoiding > > race condition / concurrent loading > > Make sure the mutex operation is killable, then, and maybe even > interruptable. Okay. > > > - Perform the capsule update and error return at flush() function > > > > Is there anything I missed? Any one still have concern with this idea? > > Thanks for providing the ideas as well as the review. > > > > If it works (and cat really does fail reliably), then it seems okay to me. > > However, since I like pulling increasing numbers of my hats, someone should > verify that the common embedded cat implementations are also okay with > this. For example, I haven't yet found any code in busybox's cat > implementation that closes stdout. > > Given that the main targets of this (for now, at least) are embedded, this > might be a problem. > I think we shouldn't focus on the cat implementation for the close issue. My understanding about this action: cat file.bin > /sys/..../capsule_loader It is actually the ">" (IO redirection) who perform the open write & close to this "/sys/..../capsule_loader" file note and not the "cat" do it. So, I think your answer can be found at Shell source code. More info about the IO redirection can be found at: http://www.tldp.org/LDP/abs/html/io-redirection.html Busybox Shell Souce code can be found at: https://lxr.missinglinkelectronics.com/busybox/shell/ash.c Regards, Wilson ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?