[PATCH 3/3] cxl/hdm: Restore commit_end when decoder enumeration fails
Alison Schofield <[email protected]>
| Newsgroups | org.kernel.vger.linux-cxl |
|---|---|
| Message-ID | <dd46f240738e3eb2663b23ed79fd9544ff5dccfa.1783974681.git.alison.schofield@intel.com> |
commit_end tracks the highest committed decoder on a port. It gets
advanced before decoder enumeration is complete, so a later failure
leaves it pointing at a decoder that was never added. The next probe
then rejects decoder0 as out of order and enumeration fails.
Reset commit_end before enumerating so it is rebuilt from the decoders
actually committed on each probe.
Fixes: 176baefb2eb5 ("cxl/hdm: Commit decoder state to hardware")
Fixes: b777e9bec960 ("cxl/hdm: Emulate HDM decoder from DVSEC range registers")
Signed-off-by: Alison Schofield <[email protected]>
---
drivers/cxl/core/hdm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
index 75d17120233d..0145d3db3107 100644
--- a/drivers/cxl/core/hdm.c
+++ b/drivers/cxl/core/hdm.c
@@ -1178,6 +1178,10 @@ static int devm_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm,
cxl_settle_decoders(cxlhdm);
+ /* Reset to the none committed baseline for a fresh enumeration */
+ scoped_guard(rwsem_write, &cxl_rwsem.region)
+ port->commit_end = -1;
+
for (i = 0; i < cxlhdm->decoder_count; i++) {
int rc, target_count = cxlhdm->target_count;
struct cxl_decoder *cxld;
--
2.37.3