public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] cxl: Test CXL_DECODER_F_LOCK as a bitmask
@ 2026-02-23 19:13 Alison Schofield
  2026-02-23 19:13 ` [PATCH v2 2/2] cxl/region: Test CXL_DECODER_F_NORMALIZED_ADDRESSING " Alison Schofield
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alison Schofield @ 2026-02-23 19:13 UTC (permalink / raw)
  To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: linux-cxl

The CXL decoder flags are defined as bitmasks, not bit indices.
Using test_bit() to check them interprets the mask value as a bit
index, which is the wrong test.

For CXL_DECODER_F_LOCK the test reads beyond the defined bits, causing
the test to always return false and allowing resets that should have
been blocked.

Replace test_bit() with a bitmask check.

Fixes: 2230c4bdc412 ("cxl: Add handling of locked CXL decoder")
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---

Changes in v2:
Split patches to align w Fixes Tags for backport ease
Rebased on 7.0-rc1

 drivers/cxl/core/hdm.c    | 2 +-
 drivers/cxl/core/region.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
index e3f0c39e6812..c222e98ae736 100644
--- a/drivers/cxl/core/hdm.c
+++ b/drivers/cxl/core/hdm.c
@@ -904,7 +904,7 @@ static void cxl_decoder_reset(struct cxl_decoder *cxld)
 	if ((cxld->flags & CXL_DECODER_F_ENABLE) == 0)
 		return;
 
-	if (test_bit(CXL_DECODER_F_LOCK, &cxld->flags))
+	if (cxld->flags & CXL_DECODER_F_LOCK)
 		return;
 
 	if (port->commit_end == id)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index fec37af1dfbf..780ec947ecf2 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -1100,7 +1100,7 @@ static int cxl_rr_assign_decoder(struct cxl_port *port, struct cxl_region *cxlr,
 static void cxl_region_setup_flags(struct cxl_region *cxlr,
 				   struct cxl_decoder *cxld)
 {
-	if (test_bit(CXL_DECODER_F_LOCK, &cxld->flags)) {
+	if (cxld->flags & CXL_DECODER_F_LOCK) {
 		set_bit(CXL_REGION_F_LOCK, &cxlr->flags);
 		clear_bit(CXL_REGION_F_NEEDS_RESET, &cxlr->flags);
 	}

base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-23 23:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 19:13 [PATCH v2 1/2] cxl: Test CXL_DECODER_F_LOCK as a bitmask Alison Schofield
2026-02-23 19:13 ` [PATCH v2 2/2] cxl/region: Test CXL_DECODER_F_NORMALIZED_ADDRESSING " Alison Schofield
2026-02-23 21:27   ` Gregory Price
2026-02-23 23:06   ` Dave Jiang
2026-02-23 21:27 ` [PATCH v2 1/2] cxl: Test CXL_DECODER_F_LOCK " Gregory Price
2026-02-23 23:05 ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox