Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp228067ybp; Thu, 10 Oct 2019 17:04:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxAScYpD1MS1vUA53jS4CTGRmpEempUL8cgdHbJVfw3VU+jUMaOLWJWWSwuYyrinMCSG1pl X-Received: by 2002:a05:6402:74b:: with SMTP id p11mr10825058edy.84.1570752275386; Thu, 10 Oct 2019 17:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570752275; cv=none; d=google.com; s=arc-20160816; b=XS761xZc7XF+UDIJ23pFgm49/1ryvG1Z5h8autoI3FlrRjlUBHG2oyQAztEUscbKTZ ZYhNiuTBFiB+4KN2Oa4Ve1ynW0MBgQv/R7dBrYlJzhSZ7td17z0BmS98NEz9knadj/CV 0G4MCamyMAfmmRWNc5zr/wxmunmeJX/fYBXUnPtJwek/0Upo9LccvVcSNf4mK+AbsK4Y CxcoCQ7DyoOleEqjsFB3RLtNrNZhu+RBp1GHxslahAd1WaPsRK/sUV5hxj1g/1L9NNaD 5GqPbX/MpBBKISdoBDwXLl1KYzf7cAknMaTe2PfVyR0Mh6lRDMPcEvFA5xpPnOS5ob8g VU+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :dkim-signature; bh=uRr/kFsIZaHy8HYqLPJ1ymRYxil+0WCAOjr/vPbR/yI=; b=ryDfcEgEvghLkJBvxpIOG/iNQDtDr2I8bJo7d14iihfXfR/uvCb4fn6ZibWU62Jbum 0djPWcedMjB13VfeXrcvz/es4rFv4/41QIuNjqA5cco6N8KG6d7tNKdYvyCU5QYMimVC WbP6OrHp42xg4dYvSk2c/d8N6Tivzxjb8viC9+kESp1df4jIppz2rxKqmDmELWJPoxpG ou5S0C2YT5NtewX35MTdmNiHlUeeS4bVS4YVhtPI1NuQi1G8EXG8+OtDQ2z7RJ1mr002 TDiNEu39OtWqdkPmIDYIapbHbzNfMJd3iu/vAjjjfLtJ07MFZ9BU5gXPRRgoBq1rc1Z5 DZTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=TW5X1Faw; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=dv8mhG6b; 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 t18si4184326ejr.205.2019.10.10.17.04.11; Thu, 10 Oct 2019 17:04:35 -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; dkim=pass header.i=@sholland.org header.s=fm3 header.b=TW5X1Faw; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=dv8mhG6b; 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 S1726725AbfJKADl (ORCPT + 99 others); Thu, 10 Oct 2019 20:03:41 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:37555 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726290AbfJKADl (ORCPT ); Thu, 10 Oct 2019 20:03:41 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 0B7B0220BA; Thu, 10 Oct 2019 20:03:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 10 Oct 2019 20:03:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=u Rr/kFsIZaHy8HYqLPJ1ymRYxil+0WCAOjr/vPbR/yI=; b=TW5X1FawG9/vU9ewM rj+MktaT10lfOWvseyOQw8LeApUvz/hXJGIc4BssTigcyN50+4QEavXZjyh/gaFo pvUbU6CtieOnRC1AoiTVdtm0fWQfjdrgebdM1YZ95qAOINSKAEyDLZ7+ZErWXo4W MpmJ4D4dNotk4Ki7vIFWMitrMw0lEsHJvbEGpOg2QjU2i9I371OOxWXRijtftH1x rEL92mOceX0XDaZLe2ybetFcuQYBr8k49SY1y70XQ2xVLWRhA33FODjrgY4V9BnX 1+/ghsAPqHTW4d5bV65FZEtxaF0Y6mMWVaFk/FFQf3mpp9zAGfDNuzdn2RSXo8G5 wXJpQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=uRr/kFsIZaHy8HYqLPJ1ymRYxil+0WCAOjr/vPbR/ yI=; b=dv8mhG6bkghcqQrxe6LT3iLVXIOTLUuxDBvF6Lz3abzYR/Xrz+FU2sd/z urBBpIXQLWSDelgvaRRqyLpQgJffRzJEyqSruTd9OYbGNhxezyzRf3pFJPWm8Gcc nZ5PdUkjM5hF4heeWSFVqBYx9nG4lKCKVIeXqrpyA/HgVKBsJLmgyIhRSEwV9amU exMjCym7z/5j3RjIZ6LAaQwkD7Q1SOFIKtPxSA0ojcqKI0GexoVNwF7djlR8KS6C yFanffc0IFJUTnLh81eMQBBEA2fZs4WNKV7coU0cBcBGbi1aSnH+9Y5CNBZ3AUvj 8DUmGs6TqXDlr4ZQlx2mdG2qxgAPA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrieeggddvlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucfkph epjedtrddufeehrddugeekrdduhedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehsrghm uhgvlhesshhhohhllhgrnhgurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.50.162] (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 0386A8005A; Thu, 10 Oct 2019 20:03:38 -0400 (EDT) Subject: Re: [PATCH 2/2] firmware: coreboot: Export active CBFS partition To: Julius Werner , Stephen Boyd Cc: LKML , Patrick Rudolph , Greg Kroah-Hartman , Ben Zhang , Filipe Brandenburger , Duncan Laurie , Thomas Gleixner References: <20191008115342.28483-1-patrick.rudolph@9elements.com> <20191008115342.28483-2-patrick.rudolph@9elements.com> <5d9d120b.1c69fb81.b6201.1477@mx.google.com> From: Samuel Holland Message-ID: Date: Thu, 10 Oct 2019 19:03:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/9/19 4:19 PM, Julius Werner wrote: >> Somehow we've gotten /sys/firmware/log to be the coreboot log, and quite >> frankly that blows my mind that this path was accepted upstream. >> Userspace has to know it's running on coreboot firmware to know that >> /sys/firmware/log is actually the coreboot log. > > Not really sure I understand your concern here? That's the generic > node for the log from the mainboard firmware, whatever it is. It was > originally added for non-coreboot firmware and that use is still > supported. If some other non-coreboot firmware wants to join in, it's > welcome to do so -- the interface is separated out enough to make it > easy to add more backends. > > I do agree that if we want to add other, more coreboot-specific nodes, > they should be explicitly namespaced. > >> But I also wonder why this is being exposed by the kernel at all? > > I share Stephen's concern that I'm not sure this belongs in the kernel > at all. There are existing ways for userspace to access this > information like the cbmem utility does... if you want it accessible > from fwupd, it could chain-call into cbmem or we could factor that > functionality out into a library. If you want to get away from using > /dev/mem for this, we could maybe add a driver that exports CBMEM or > coreboot table areas via sysfs... but then I think that should be a > generic driver which makes them all accessible in one go, rather than > having to add yet another driver whenever someone needs to parse > another coreboot table blob for some reason. We could design an > interface like /sys/firmware/coreboot/table/ where every entry in > the table gets exported as a binary file. > > I think a specific sysfs driver only makes sense for things that are > human readable and that you'd actually expect a human to want to go > read directly, like the log. Maybe exporting FMAP entries one by one > like Stephen suggests could be such a case, but I doubt that there's a > common enough need for that since there are plenty of existing ways to > show FMAP entries from userspace (and if there was a generic interface > like /sys/firmware/coreboot/table/37 to access it, we could just add a > new flag to the dump_fmap utility to read it from there) There's already a node in sysfs for every coreboot table entry: /sys/bus/coreboot/devices/corebootN where N is the index of the entry in the coreboot table. I suggest 1) Rename the devices based on their tag instead of their position in the table, so the names are stable and meaningful. I don't know why I didn't do that in the first place. Doing that gives you a device kobject you can hang additional sysfs attributes off of. 2) If we want userspace to have access to the raw binary table entry (which sounds like a good idea to me), add that sysfs attribute in coreboot_table_populate() after creating each device. That way it would be present regardless of whether or not there's a specific driver loaded for that table entry. This solves the immediate problem of needing /dev/mem to access coreboot tables, while leaving open the possibility of writing kernel drivers in the future if that would be more beneficial than parsing the data in userspace (i.e. if the kernel can do something more with the data than just exporting it). Samuel