lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <e7173ab2-d3b2-4f75-beb8-32593b868774@www.fastmail.com>
Date:   Wed, 22 Dec 2021 00:11:01 +0000
From:   "John Thomson" <lists@...nthomson.fastmail.com.au>
To:     Rafał Miłecki <zajec5@...il.com>,
        "Srinivas Kandagatla" <srinivas.kandagatla@...aro.org>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        "Jonathan Corbet" <corbet@....net>
Cc:     "Daniel Vetter" <daniel.vetter@...ll.ch>,
        "Dan Williams" <dan.j.williams@...el.com>,
        "Bjorn Helgaas" <bhelgaas@...gle.com>,
        Krzysztof Wilczyński <kw@...ux.com>,
        "Heiner Kallweit" <hkallweit1@...il.com>,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        Rafał Miłecki <rafal@...ecki.pl>
Subject: Re: [PATCH 2/2] nvmem: expose NVMEM cells in sysfs

Hi Rafał,

Thank you for working on this.
I hacked together the same functionality based on kernel 5.10 some months ago,
while I was testing an MTD parser based TLV NVMEM cells parser,
and have some general comments.

On Mon, 20 Dec 2021, at 06:47, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@...ecki.pl>
>
> This allows reading NVMEM cells using /sys/bus/nvmem/devices/*/cells/*
> which may be helpful for userspace & debugging purposes.
>
> Signed-off-by: Rafał Miłecki <rafal@...ecki.pl>
> ---
>  Documentation/driver-api/nvmem.rst | 11 ++++++
>  drivers/nvmem/core.c               | 60 ++++++++++++++++++++++++++++++
>  2 files changed, 71 insertions(+)
>
> diff --git a/Documentation/driver-api/nvmem.rst 
> b/Documentation/driver-api/nvmem.rst
> index 287e86819640..20f7d68143be 100644
> --- a/Documentation/driver-api/nvmem.rst
> +++ b/Documentation/driver-api/nvmem.rst
> @@ -185,6 +185,17 @@ ex::
>    *
>    0001000
> 
> +Single cells can be read using files located at::
> +
> +	/sys/bus/nvmem/devices/*/cells/*
> +
> +ex::
> +
> +  hexdump -C /sys/bus/nvmem/devices/mtd0/cells/mac

I found that NVMEM cell names did not need to be unique, but sysfs entry names do.
I am not sure if there are characters that NVMEM cell names allow,
but sysfs entry names forbid.
I used an ID allocator, in a similar style to what is done for MTD sysfs devices in mtdcore.c.

Could the cell (data) binary attribute be in a subfolder for each cell?
Example:
/sys/bus/nvmem/devices/mtd0/cells/cell0/cell
or
/sys/bus/nvmem/devices/mtd0/cells/cell0/cell_data

This way, we can easily expose additional properties of the cell.
I exposed the name, offset, bytes, bit_offset, and an of_node link (where available) this way.
I only needed these for testing, but the cell length (bytes) provided a cheap means for initial validation.

I did not look into cell post-processing, but it should be considered:
https://lore.kernel.org/all/20211006144729.15268-1-srinivas.kandagatla@linaro.org/
and RFC https://lore.kernel.org/all/CAL_JsqL55mZJ6jUyQACer2pKMNDV08-FgwBREsJVgitnuF18Cg@mail.gmail.com/
Will the cell data exposed here be prior to post-processing?


Thank you

Cheers,
-- 
  John Thomson

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ