Patch "cxl/region: Flag partially torn down regions as unusable" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    cxl/region: Flag partially torn down regions as unusable

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     cxl-region-flag-partially-torn-down-regions-as-unusa.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit efed36881a583c305bceaebe7dbb055edd141ff9
Author: Dan Williams <dan.j.williams@xxxxxxxxx>
Date:   Fri Jun 16 18:24:34 2023 -0700

    cxl/region: Flag partially torn down regions as unusable
    
    [ Upstream commit 2ab47045ac96a605e3037d479a7d5854570ee5bf ]
    
    cxl_region_decode_reset() walks all the decoders associated with a given
    region and disables them. Due to decoder ordering rules it is possible
    that a switch in the topology notices that a given decoder can not be
    shutdown before another region with a higher HPA is shutdown first. That
    can leave the region in a partially committed state.
    
    Capture that state in a new CXL_REGION_F_NEEDS_RESET flag and require
    that a successful cxl_region_decode_reset() attempt must be completed
    before cxl_region_probe() accepts the region.
    
    This is a corollary for the bug that Jonathan identified in "CXL/region
    :  commit reset of out of order region appears to succeed." [1].
    
    Cc: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Link: http://lore.kernel.org/r/20230316171441.0000205b@xxxxxxxxxx [1]
    Fixes: 176baefb2eb5 ("cxl/hdm: Commit decoder state to hardware")
    Reviewed-by: Dave Jiang <dave.jiang@xxxxxxxxx>
    Link: https://lore.kernel.org/r/168696507423.3590522.16254212607926684429.stgit@xxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 3b3bbd98e99d5..c1422167ab02b 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -182,14 +182,19 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)
 				rc = cxld->reset(cxld);
 			if (rc)
 				return rc;
+			set_bit(CXL_REGION_F_NEEDS_RESET, &cxlr->flags);
 		}
 
 endpoint_reset:
 		rc = cxled->cxld.reset(&cxled->cxld);
 		if (rc)
 			return rc;
+		set_bit(CXL_REGION_F_NEEDS_RESET, &cxlr->flags);
 	}
 
+	/* all decoders associated with this region have been torn down */
+	clear_bit(CXL_REGION_F_NEEDS_RESET, &cxlr->flags);
+
 	return 0;
 }
 
@@ -2740,6 +2745,13 @@ static int cxl_region_probe(struct device *dev)
 		goto out;
 	}
 
+	if (test_bit(CXL_REGION_F_NEEDS_RESET, &cxlr->flags)) {
+		dev_err(&cxlr->dev,
+			"failed to activate, re-commit region and retry\n");
+		rc = -ENXIO;
+		goto out;
+	}
+
 	/*
 	 * From this point on any path that changes the region's state away from
 	 * CXL_CONFIG_COMMIT is also responsible for releasing the driver.
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 70ab8fcd0377c..dcebe48bb5bb5 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -469,6 +469,14 @@ struct cxl_region_params {
  */
 #define CXL_REGION_F_AUTO 0
 
+/*
+ * Require that a committed region successfully complete a teardown once
+ * any of its associated decoders have been torn down. This maintains
+ * the commit state for the region since there are committed decoders,
+ * but blocks cxl_region_probe().
+ */
+#define CXL_REGION_F_NEEDS_RESET 1
+
 /**
  * struct cxl_region - CXL region
  * @dev: This region's device



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux