Re: [PATCH v4 2/2] nvmem: aspeed: Add read-only AST2600 OTP support

From: Prasanth

Date: Fri Dec 04 2026 - 20:06:23 EST


Hi Andrew,

You’re right that this driver never writes SEC54. I retained the
per-read check because Neal clarified that the register is monotonic
and may be increased by firmware or another privileged agent until ARM
reset.

Our board had SEC54 = 0, and we did not induce a protected-read case,
so we do not currently have hardware evidence describing the
controller’s response to such a read.

Neal, can you confirm whether Linux is expected to coexist with
another agent that may increase SEC54 after probe? If not, I can
simplify the driver to rely on the fixed NVMEM keepout and remove the
live check. If such changes are supported, I propose retaining the
conservative per-read check and returning -EACCES before issuing a
command for a sampled protected range.

Regards,
Prasanth

On Fri, Dec 4, 2026 at 11:14 AM Andrew Jeffery
<andrew@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Prasanth,
>
> On Fri, 2026-12-04 at 07:21 +0530, Prasanth wrote:
> > Hi Andrew,
> >
> > Thanks for the detailed review. I’ll address these points in the next revision.
> > - fix the continuation indentation and unwrap the short bounds check.
> > - use readl_poll_timeout() for idle polling. The 1 µs delay will
> > remain only after issuing an OTP command, as required by ASPEED’s
> > clarification.
> > - reject odd addresses in the internal pair-read helper. Public reads
> > may still begin at an odd word by selecting the containing even pair.
> > - move offset and length validation into the helper that performs the
> > arithmetic and copying, while preserving zero-length success and
> > overflow-safe bounds checks.
> > - ensure the failure latch is checked before any further controller
> > operation. Probe already stops after the first initialization failure
> > and only performs relock cleanup.
> > - consider the mutex annotations and context-analysis support for
> > state protected by the mutex.
> > - inline the single-use initialization helper if that makes the flow clearer.
> > - use devm_kzalloc_obj() if there is no compatibility concern with the
> > supported kernel baseline.
> >
> > The probe-time NVMEM keepout covers the fixed CONF0 range. Neal
> > confirmed that SEC54 can increase until an ARM reset, including while
> > Linux is running,
> >
>
> Sure, but what actually increases it? Nothing I saw in the driver does
> so.
>
> > and recommended checking it on each read.
> > https://lore.kernel.org/linux-aspeed/KL1PR0601MB3986A356BD06F98D0FF9AD5E80792@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
>
> I don't think we should be accounting for it changing outside of the
> driver's control.
>
> > If SEC54 grows after probe and a request falls within the newly
> > protected range, would you prefer the driver to return -EACCES before
> > issuing the read, or rely on the controller’s response?
>
> If we can't rely on the controller's response here I wonder how we rely
> on the controller at all? Can you describe its behaviour when you try
> accessing the secure region?
>
> Andrew