linux/drivers/cxl
Yuxiong Wang eacca14125 cxl: Fix premature commit_end increment on decoder commit failure
[ Upstream commit 7b6f9d9b1e ]

In cxl_decoder_commit(), commit_end is incremented before verifying
whether the commit succeeded, and the CXL_DECODER_F_ENABLE bit in
cxld->flags is only set after a successful commit. As a result, if the
commit fails, commit_end has been incremented and cxld->reset() has no
effect since the flag is not set, so commit_end remains incorrectly
incremented. The inconsistency between commit_end and CXL_DECODER_F_ENABLE
causes failure during subsequent either commit or reset operations.

Fix this by incrementing commit_end only after confirming the commit
succeeded. Also, remove the ineffective cxld->reset() call. According to
CXL Spec r4.0 8.2.4.20.12 Committing Decoder Programming, since
cxld_await_commit() has cleared the decoder commit bit on failure, no
additional reset is required.

[dj: Fixed commit log 80 char wrapping. ]
[dj: Fix "Fixes" tag to correct hash length. ]
[dj: Change spec to r4.0. ]

Fixes: 176baefb2e ("cxl/hdm: Commit decoder state to hardware")
Signed-off-by: Yuxiong Wang <yuxiong.wang@linux.alibaba.com>
Acked-by: Huang Ying <ying.huang@linux.alibaba.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/20260129064552.31180-1-yuxiong.wang@linux.alibaba.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-02-26 14:59:27 -08:00
..
core cxl: Fix premature commit_end increment on decoder commit failure 2026-02-26 14:59:27 -08:00
acpi.c cxl/acpi: Fix setup of memory resource in cxl_acpi_set_cache_size() 2025-10-14 12:59:13 -07:00
cxl.h Merge branch 'for-6.18/cxl-delay-dport' into cxl-for-next 2025-09-18 14:34:51 -07:00
cxlmem.h cxl/mem: Fix devm_cxl_memdev_edac_release() confusion 2026-02-26 14:59:24 -08:00
cxlpci.h cxl/test: Refactor decoder setup to reduce cxl_test burden 2025-09-18 09:54:50 -07:00
Kconfig cxl/edac: Support for finding memory operation attributes from the current boot 2025-05-23 13:24:38 -07:00
Makefile cxl/port: Fix CXL port initialization order when the subsystem is built-in 2024-10-25 16:06:49 -05:00
mem.c cxl/edac: Add CXL memory device patrol scrub control feature 2025-05-23 13:24:09 -07:00
pci.c cxl/pci: Replace mutex_lock_io() w mutex_lock() for mailbox access 2025-06-30 16:36:06 -07:00
pmem.c cxl/pci: Drop the parameter is_port of cxl_gpf_get_dvsec() 2025-04-09 12:48:18 -07:00
pmu.h cxl/pci: Find and register CXL PMU devices 2023-05-30 11:20:35 -07:00
port.c cxl: Defer dport allocation for switch ports 2025-09-18 09:55:22 -07:00
security.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00