]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/nvram/aspeed_otp: Add OTP programming semantics and tracing
authorKane-Chen-AS <kane_chen@aspeedtech.com>
Tue, 12 Aug 2025 09:40:02 +0000 (17:40 +0800)
committerCédric Le Goater <clg@redhat.com>
Mon, 29 Sep 2025 16:00:20 +0000 (18:00 +0200)
commit8970c95c4db99dd44ff463acc14c69510776cdee
tree348ef3c217d74267f420bcc2124d34a7fdc00c40
parentc6b4279a9240a838632e2d689a138da96545c540
hw/nvram/aspeed_otp: Add OTP programming semantics and tracing

Implement correct OTP programming behavior for Aspeed OTP:
- Support read-modify-write flow with one-way bit programming:
  * prog_bit uses 0s as the "to-be-programmed" mask.
  * Even-indexed words: 0->1, odd-indexed words: 1->0.
  * Reject non-programmable requests and log conflicts.
- Enable unaligned accesses in MemoryRegionOps.
  Since each OTP address maps to a 1DW (4B) or 2DW (8B) block in the
  backing store, upper-layer accesses may be unaligned to block
  boundaries.

This matches the irreversible, word-parity-dependent programming rules
of Aspeed SoCs and exposes changes via QEMU trace events.

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250812094011.2617526-6-kane_chen@aspeedtech.com
[ clg: Fixed PRIx64 format in aspeed_otp_write() ]
Signed-off-by: Cédric Le Goater <clg@redhat.com>
hw/nvram/aspeed_otp.c
hw/nvram/trace-events