Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp487270rwb; Wed, 10 Aug 2022 11:30:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR76FlGn7CpM7sp5qlnMnct359RsvwQxX/6lRsrmgnJCf+FNBr7/bzs4av/OtJxcXCNKngbD X-Received: by 2002:a05:6402:424e:b0:43d:9d9f:38f9 with SMTP id g14-20020a056402424e00b0043d9d9f38f9mr27815423edb.411.1660156212646; Wed, 10 Aug 2022 11:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660156212; cv=none; d=google.com; s=arc-20160816; b=00WnLDmsF4D+17PFbuVULo7IL763jdeqBjZ/W7TP9w+pKFgCCzZZgT0jKAuY3QhKX4 Q3NO/4CSXaqvyr7xAEcPeIdslstL7jQuzci28t7Dm0g7vWDSyJPUcFLQvabYgLg23Oya NIbrTcQ5GFgSlj6KxrpHmQBLtg3FSjRiAuRVKm8XtMTdQNVgiJ7fr3fvnHOuigfvxsuz 6FQ0YwjJUoKJUmkWHGcgwdEsSIWvUCboB9JuVSum0WXS3YQLGckJfoiXOUk7or1WN4Mm B84hRVY+ME4bTh0HfTq6zfpkpFVg8vLsm8TCOutA/0KBrW/aiHYnpmHrXlG1MGp1Jf1C NuUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=yb0FqRtMqUKU+P/ctb3sogkoQRmLyX6XlF3M71/csC8=; b=M5kOY1fYYLN8ozLMQXWGujq1VI3f2vqVVfIf/qYLo3kXSCvuaTviJSBNOprHVoyoQz Cxp5QBKkNuMk780jrFsDoLK2vvQ2kdpxRZh8LKvo5y3WzgJCSao3pEAL5Kl3zQnmlPrg 8ZxE5KyC4ylUbn6oG+F5vSuf01zlIX4NYFYX29KGZLQ1XqwZMtLunO/9R0pF+ndvKIX4 hO8Z5L1JjFyO4xk1L7COAT8BjttcCixQDFJCp6HN8MMU0cWSgK5lTMuhvF/yZFDPD00N hV5U1OHEqvNK238c5m6WFBm2Hs8Z61EQVdWHV/Nk4b0Lo61E1cB4cYJJCM+KermPICBZ Ad7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HxchlGZH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a170906644800b0072f0a99a62bsi4435922ejn.143.2022.08.10.11.29.47; Wed, 10 Aug 2022 11:30:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HxchlGZH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233009AbiHJQkk (ORCPT + 99 others); Wed, 10 Aug 2022 12:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233054AbiHJQkh (ORCPT ); Wed, 10 Aug 2022 12:40:37 -0400 Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 179F53B2 for ; Wed, 10 Aug 2022 09:40:36 -0700 (PDT) Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-10ee900cce0so18444616fac.5 for ; Wed, 10 Aug 2022 09:40:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:from:to:cc; bh=yb0FqRtMqUKU+P/ctb3sogkoQRmLyX6XlF3M71/csC8=; b=HxchlGZH1QrRpSnzRgFnJlioSzOls6/F2rKMVA6MAOV4iA4+KU6W40atEbSOubwB3w c/JdsXCLC2kqN4sNBOEkqeVrfzES2OBzfPC7WCW9Z0WOjXod+T0WfBTSvsV8Oor7XtJ8 jiUjkDA/WRhDfZXJx0kK2mqUs69AvQcXStVWU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:x-gm-message-state:from:to:cc; bh=yb0FqRtMqUKU+P/ctb3sogkoQRmLyX6XlF3M71/csC8=; b=DLiueFExN3L0gEAhAY21HF3K62A2dt/V206v6uyy5UAvTxnYODDppqZx6592wQoa9w 4tL/wpE+8KiFyTe72IJddarEXBbjIIsPKTIvD0Mcu9Ya57h2QW7F1r4YAz9IhP0VFsfp Oj5A0GdaPznaOpovDkhKCZGwzmJmfu3YK/+/yJlkzUkoZw3RUtZPR4iDVDnychPgCgBD YM4Q1NFE1E4p8YA5pg0u+P6toK+1qvv5RNCjYdtjT199PbZQj+j4b6XPWkzNUS7AULvn MIimPnwk76kJl6fcWbydQoMnlcBYf3RQTtT9zj7ZEulNWMYohuEvb4tbX/ZNDWFhQEiG rtwA== X-Gm-Message-State: ACgBeo043Yu4eBOV3LhW++dSdUNVJqwBro0Wq8S8iVgSxd4fDSp+YRBN 48phyMJwPXHonen8jepUFrZQBoYW6fbNDU34/ppoObLQMX4= X-Received: by 2002:a05:6870:9a17:b0:e9:3d1:f91a with SMTP id fo23-20020a0568709a1700b000e903d1f91amr1879997oab.44.1660149635427; Wed, 10 Aug 2022 09:40:35 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 10 Aug 2022 11:40:34 -0500 MIME-Version: 1.0 In-Reply-To: References: <20220804142856.306032-1-jrosenth@chromium.org> From: Stephen Boyd User-Agent: alot/0.10 Date: Wed, 10 Aug 2022 11:40:34 -0500 Message-ID: Subject: Re: [PATCH v7] firmware: google: Implement cbmem in sysfs driver To: Julius Werner Cc: Jack Rosenthal , chrome-platform@lists.linux.dev, LKML , Tzung-Bi Shih , Guenter Roeck Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Julius Werner (2022-08-04 16:14:43) > > Quoting Jack Rosenthal (2022-08-04 07:28:56) > > > cbmem entries can be read from coreboot table > > > 0x31 (LB_TAG_CBMEM_ENTRY). This commit exports access to cbmem > > > entries in sysfs under /sys/firmware/coreboot/cbmem-*. > > > > > > Link: https://issuetracker.google.com/239604743 > > > > Is what you intend to use from here essentially an nvram? If so, it may > > make more sense to expose just that entry in drivers/nvmem/ as a > > read-only sort of nvmem. > > No, it is not NV. It's just a normal memory buffer allocated and > filled by firmware on boot and placed in a region of normal DRAM > that's marked as reserved. Alright cool. The bug says 'vbnv' so I was guessing 'nv' meant non-volatile. > > > It isn't clear to me what the structure of this path is. I'd expect to > > see an entry for each 'address', 'size', 'id', 'mem' with a different > > What/Date/Contact/Description. If those attributes are all within a > > directory in sysfs then there could be a top-level description for that > > as well. > > CBMEM buffers are used by coreboot for all sorts of things and we > regularly define new ones. We can't maintain a full list of all IDs in > kernel sources because it would be a ton of churn for no reason -- > best we could do is to add a link to the ID list in the coreboot repo > (e.g. https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/master/src/commonlib/bsd/include/commonlib/bsd/cbmem_id.h). Agreed, that's a good approach. > We really only care about one of these right now and many of them will > never be relevant to the kernel, but I still thought that while we're > doing this we might as well provide a generic interface to all of them > because others may become useful in the future (and then you don't > have to update the kernel every time you get a new use case for some > userspace tool wanting to interact with some resident data structure > from coreboot). Exposing more than is necessary in the kernel ABI could get into problems with backwards compatibility. It also means we have to review the ABI with the consideration that something may change in the future and cbmem would be exposing something we don't want exposed, or maybe it is writeable when it shouldn't be? Furthermore, if the ABI that the kernel can expose already exists then we're better off because there may already be userspace programs written for that ABI with lessons learned and bugs ironed out. In this case, I was hoping that it was an nvmem, in which case we could tie it into the nvmem framework and piggyback on the nvmem APIs. It also helps to expose a more generic ABI to userspace instead of developing a bespoke solution requiring boutique software. Of course sometimes things can't be so generic so code has to be written. > > > Do you need to be able to write cbmem entries? > > Yes, see the use case in the bug (using the vboot workbuffer from > coreboot as a write-through cache for the vboot nvdata on flash). Is it a cached non-volatile memory?