Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1084693rwb; Thu, 4 Aug 2022 17:06:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR5HCkjzoeumQ1Fa3qBcqQjb8tfSC7VVL2unZBbX5j2PEfljqUZ77XTpqYXIFcSx9A7pUV08 X-Received: by 2002:a17:90a:d58e:b0:1f4:f9a5:22a8 with SMTP id v14-20020a17090ad58e00b001f4f9a522a8mr4539038pju.58.1659658019052; Thu, 04 Aug 2022 17:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659658019; cv=none; d=google.com; s=arc-20160816; b=Fnfapu24BO6szZCMmrmHPHpQinIbXQv8zi+LV2lWXzw2m896GFIqz6vq24wEL7AUqd hfrPT4mVrPVmH9w1lQvGFfX+DRFQ2qGsyPNuSw6t4weo1k1UpXeMBAmXYWh1TctFgexn WMrBrtH6QHo3TQImQjV9okDLF763UNC0GKhbSDGq8qUdQ5o10ioBoTt6eZgYwwi2FvhW CNGiDEmTyFTm/nk6eIssqBt8Y4UQFHrQOAsPslT0UB02R9HgVv6EFftfMA9iacwKoLbP WkXn+0lSe12/umqGbB+6+oT/JJrIgYe8XUGEmE+TR3QuUyWAEsL4MBKhW709b9tRE7Eg ND0A== 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:from:in-reply-to :references:mime-version:dkim-signature; bh=UqlbzCJAY8VENrCVMz+v3dILFUlDvFsp0zoGxXFbGcI=; b=A/Nl9x7tJQY1mea3h8r5MJZzZs8q2YuO7icb3xDGc0Po9aCSFi9J5WJNYc/pIej9DI /MaUkrvcWSkEwSo9+DFyYvv1O9FSP5eYsQLr1ES4AOs32BKmBQe7G9VpMnJpV14B39Wc 01pwbmrIL0aJf71vGUApsln2Zba8f7tgIR17m7y8X2pBs7TKAgRr6PysvsMXz+ipK2mp NA60lBdklaGTgPNaiQcb3ggNqLsoUxYZHWCVJLdsiVNkB1cipN+U4/KUGUgT0QbwlkP1 KY7O6n+xQ27m/a2WSDJGQXeDrM3HesyH3rpXQYKl4wZYNv3wSIfYiFh1+f65bK0cExnV 0fzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Miutd2Bo; 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 u186-20020a6385c3000000b0041bd9d0297dsi1182343pgd.549.2022.08.04.17.06.44; Thu, 04 Aug 2022 17:06:59 -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=Miutd2Bo; 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 S235553AbiHDXPA (ORCPT + 99 others); Thu, 4 Aug 2022 19:15:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbiHDXO6 (ORCPT ); Thu, 4 Aug 2022 19:14:58 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D3A91A395 for ; Thu, 4 Aug 2022 16:14:56 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id z16so1350344wrh.12 for ; Thu, 04 Aug 2022 16:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=UqlbzCJAY8VENrCVMz+v3dILFUlDvFsp0zoGxXFbGcI=; b=Miutd2BoNbFQIGTrdQElo7qVwUmVmzuXCh+XUR7Yq/r3hsQXVGt/UMCp83I70JjSZW 51vh73wQ5UbgKHxVkxlmg/DGtkvU1agW9/Aioce/UZEYdLzv7tesUpFcf8yCNpqFvwNz 4UgYBqPJIcJs7aUG/GYCOCxQyjtpj25t5vwMY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=UqlbzCJAY8VENrCVMz+v3dILFUlDvFsp0zoGxXFbGcI=; b=Rlg0igU4Zr5KEZIxH9YNSmkOXA8rGughbawX+NlD5UwwMsgJFlStfRTtODfUCikwrN Jw4ccpQcVdV8T2fCl/+bValkVRE3DkE45gwLhAPUQ5FsvBr5X5KL/b/IiOdU0YrelVlh pxvrNK60J033x6BexBIFiWSeQ1IOGWqKXcviPEvjJQcQmtANIp/GYI6ee5wHBMJsuh9C NtPk34UOakn6UIu50GDW1r5soOSDHUDvyHBwjPOnMKQ02dnIwX5t7mL4W/7UvwaEsXTF kfNY3asea2hZ9Z0Ie3ibXyskYt142rQM3JZJHptNSJZUq/B2J83oVOHQwB4vjqUPxQCa 41Dw== X-Gm-Message-State: ACgBeo1lx29j6Zbmj2qn8lfXPpe0lXQU36gQlOPabpSLUp3shm92pRSs wvDwKqu0kPJ48X+3rrY1rJS8y6sqlAie+7q4hF0nyw== X-Received: by 2002:adf:fe81:0:b0:21a:3574:ec8e with SMTP id l1-20020adffe81000000b0021a3574ec8emr2732465wrr.410.1659654894641; Thu, 04 Aug 2022 16:14:54 -0700 (PDT) MIME-Version: 1.0 References: <20220804142856.306032-1-jrosenth@chromium.org> In-Reply-To: From: Julius Werner Date: Thu, 4 Aug 2022 16:14:43 -0700 Message-ID: Subject: Re: [PATCH v7] firmware: google: Implement cbmem in sysfs driver To: Stephen Boyd Cc: Jack Rosenthal , chrome-platform@lists.linux.dev, LKML , Tzung-Bi Shih , Guenter Roeck , Julius Werner Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_SPF_WL 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 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. > 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). 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). > 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).