All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hongmei Xu" <hongmei.xu@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 1/2] dt-bindings: nvmem: add byte-mask property for non-contiguous byte selection
Date: Tue, 17 Nov 2026 06:13:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-218243@kernel.org> (raw)
In-Reply-To: <20261117-nvmem-byte-mask-for-split-macaddr-v3-1-c02177658f66@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dt-bindings: nvmem: byte-mask redefines reg size and reads
  beyond reg
--

commit c8ae5b67172a64e8cfa54543074f9aaa24c7c23a
Author: Hongmei Xu <hongmei.xu@oss.qualcomm.com>

dt-bindings: nvmem: add byte-mask property for non-contiguous byte selection

This commit adds the byte-mask property to the fixed-cell NVMEM binding
to allow selecting non-contiguous physical bytes within a 32-byte window.

> diff --git a/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml b/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml
> index 38e3ad50ff4fb..46e1101ee98ae 100644
> --- a/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml
> +++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml
> @@ -34,6 +34,20 @@ properties:
>          description:
>            Size in bit within the address range specified by reg.
>  
> +  byte-mask:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    minimum: 1
> +    description: >
> +      Bitmask selecting which physical bytes within the NVMEM device region
> +      contribute to this cell's output. Bit N set means physical byte N
> +      relative to the cell's base offset is included; selected bytes are
> +      packed into the output buffer in ascending byte order. Byte positions
> +      are relative to the cell's base offset and limited to a 32-byte window.
> +      The highest set bit must not reference a byte beyond the device size.
> +      The number of set bits must not exceed the cell's logical size given by
> +      reg. Cannot be used together with bits. Cells using byte-mask are
> +      read-only; write operations are not supported.

[Severity: Medium]
Does byte-mask redefine the size cell of reg as the logical output size
instead of the physical address range spanned by the cell in the NVMEM
device?

In fixed-cell.yaml (such as the bits property right above) and nvmem.yaml,
reg = <offset size> specifies the physical address range in the parent
NVMEM device, and sub-range selection operates within that reg range.  For
any non-contiguous selection of K bytes, the highest set bit H in
byte-mask is at least K, spanning at least K + 1 physical bytes.

If a DT author sets reg = <offset K> to match the logical size, byte-mask
reads physical bytes beyond the declared [offset, offset + K) reg range,
hiding physical address overlaps between sibling cells from DT tooling and
reviewers.  Conversely, if reg = <offset M> covers the full physical span
(M >= K + 1), the number of set bits is smaller than reg, which leaves the
remaining M - K trailing bytes unspecified in the binding and causes
consumers expecting a K-byte cell (such as nvmem_get_mac_address() or
nvmem_cell_read_u32()) to fail on the larger cell size.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-nvmem-byte-mask-for-split-macaddr-v3-0-c02177658f66@oss.qualcomm.com?part=1

  reply	other threads:[~2026-11-17  6:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  6:04 [PATCH v3 0/2] nvmem: Add byte-mask support for non-contiguous byte selection Hongmei Xu
2026-11-17  6:04 ` [PATCH v3 1/2] dt-bindings: nvmem: add byte-mask property " Hongmei Xu
2026-11-17  6:13   ` sashiko-bot [this message]
2026-11-17  8:45     ` Hongmei Xu
2026-11-17 15:29   ` Srinivas Kandagatla
2026-11-18  3:20     ` Hongmei Xu
2026-11-17  6:04 ` [PATCH v3 2/2] nvmem: core: add byte-mask support for non-contiguous cell bytes Hongmei Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-218243@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hongmei.xu@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.