@@ -3557,12 +3557,14 @@ __construct_new_region(struct cxl_root_decoder *cxlrd,
* cxl_create_region - Establish a region given an endpoint decoder
* @cxlrd: root decoder to allocate HPA
* @cxled: endpoint decoder with reserved DPA capacity
+ * @no_dax: if true no DAX device should be created
*
* Returns a fully formed region in the commit state and attached to the
* cxl_region driver.
*/
struct cxl_region *cxl_create_region(struct cxl_root_decoder *cxlrd,
- struct cxl_endpoint_decoder *cxled)
+ struct cxl_endpoint_decoder *cxled,
+ bool no_dax)
{
struct cxl_region *cxlr;
@@ -3578,6 +3580,10 @@ struct cxl_region *cxl_create_region(struct cxl_root_decoder *cxlrd,
drop_region(cxlr);
return ERR_PTR(-ENODEV);
}
+
+ if (no_dax)
+ set_bit(CXL_REGION_F_NO_DAX, &cxlr->flags);
+
return cxlr;
}
EXPORT_SYMBOL_NS_GPL(cxl_create_region, "CXL");
@@ -3713,6 +3719,9 @@ static int cxl_region_probe(struct device *dev)
if (rc)
return rc;
+ if (test_bit(CXL_REGION_F_NO_DAX, &cxlr->flags))
+ return 0;
+
switch (cxlr->mode) {
case CXL_DECODER_PMEM:
return devm_cxl_add_pmem_region(cxlr);
@@ -521,6 +521,9 @@ struct cxl_region_params {
*/
#define CXL_REGION_F_NEEDS_RESET 1
+/* Allow Type2 drivers to specify if a dax region should not be created. */
+#define CXL_REGION_F_NO_DAX 2
+
/**
* struct cxl_region - CXL region
* @dev: This region's device
@@ -875,5 +875,6 @@ struct seq_file;
struct dentry *cxl_debugfs_create_dir(const char *dir);
void cxl_dpa_debug(struct seq_file *file, struct cxl_dev_state *cxlds);
struct cxl_region *cxl_create_region(struct cxl_root_decoder *cxlrd,
- struct cxl_endpoint_decoder *cxled);
+ struct cxl_endpoint_decoder *cxled,
+ bool no_dax);
#endif /* __CXL_MEM_H__ */
@@ -61,7 +61,8 @@ struct cxl_endpoint_decoder *cxl_request_dpa(struct cxl_memdev *cxlmd,
resource_size_t max);
int cxl_dpa_free(struct cxl_endpoint_decoder *cxled);
struct cxl_region *cxl_create_region(struct cxl_root_decoder *cxlrd,
- struct cxl_endpoint_decoder *cxled);
+ struct cxl_endpoint_decoder *cxled,
+ bool no_dax);
int cxl_accel_region_detach(struct cxl_endpoint_decoder *cxled);
#endif