Patch "cxl/pci: Make cxl_dvsec_ranges() failure not fatal to cxl_pci" has been added to the 5.18-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/pci: Make cxl_dvsec_ranges() failure not fatal to cxl_pci

to the 5.18-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-pci-make-cxl_dvsec_ranges-failure-not-fatal-to-c.patch
and it can be found in the queue-5.18 subdirectory.

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



commit f788d480b43f0ed17139324d7a0b8c2032272cce
Author: Dan Williams <dan.j.williams@xxxxxxxxx>
Date:   Mon Mar 14 18:22:38 2022 -0700

    cxl/pci: Make cxl_dvsec_ranges() failure not fatal to cxl_pci
    
    [ Upstream commit 36bfc6ad508af38f212cf5a38147d867fb3f80a8 ]
    
    cxl_dvsec_ranges(), the helper for enumerating the presence of an active
    legacy CXL.mem configuration on a CXL 2.0 Memory Expander, is not fatal
    for cxl_pci because there is still value to enable mailbox operations
    even if CXL.mem operation is disabled. Recall that the reason cxl_pci
    does this initialization and not cxl_mem is to preserve the useful
    property (for unit testing) that cxl_mem is cxl_memdev + mmio generic,
    and does not require access to a 'struct pci_dev' to issue config
    cycles.
    
    Update 'struct cxl_endpoint_dvsec_info' to carry either a positive
    number of non-zero size legacy CXL DVSEC ranges, or the negative error
    code from __cxl_dvsec_ranges() in its @ranges member.
    
    Reported-by: Krzysztof Zach <krzysztof.zach@xxxxxxxxx>
    Fixes: 560f78559006 ("cxl/pci: Retrieve CXL DVSEC memory info")
    Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Reviewed-by: Davidlohr Bueso <dave@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/164730735869.3806189.4032428192652531946.stgit@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index c4941a3ca6a8..bb92853c3b93 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -462,13 +462,18 @@ static int wait_for_media_ready(struct cxl_dev_state *cxlds)
 	return 0;
 }
 
-static int cxl_dvsec_ranges(struct cxl_dev_state *cxlds)
+/*
+ * Return positive number of non-zero ranges on success and a negative
+ * error code on failure. The cxl_mem driver depends on ranges == 0 to
+ * init HDM operation.
+ */
+static int __cxl_dvsec_ranges(struct cxl_dev_state *cxlds,
+			      struct cxl_endpoint_dvsec_info *info)
 {
-	struct cxl_endpoint_dvsec_info *info = &cxlds->info;
 	struct pci_dev *pdev = to_pci_dev(cxlds->dev);
+	int hdm_count, rc, i, ranges = 0;
 	struct device *dev = &pdev->dev;
 	int d = cxlds->cxl_dvsec;
-	int hdm_count, rc, i;
 	u16 cap, ctrl;
 
 	if (!d) {
@@ -545,10 +550,17 @@ static int cxl_dvsec_ranges(struct cxl_dev_state *cxlds)
 		};
 
 		if (size)
-			info->ranges++;
+			ranges++;
 	}
 
-	return 0;
+	return ranges;
+}
+
+static void cxl_dvsec_ranges(struct cxl_dev_state *cxlds)
+{
+	struct cxl_endpoint_dvsec_info *info = &cxlds->info;
+
+	info->ranges = __cxl_dvsec_ranges(cxlds, info);
 }
 
 static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
@@ -617,10 +629,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (rc)
 		return rc;
 
-	rc = cxl_dvsec_ranges(cxlds);
-	if (rc)
-		dev_warn(&pdev->dev,
-			 "Failed to get DVSEC range information (%d)\n", rc);
+	cxl_dvsec_ranges(cxlds);
 
 	cxlmd = devm_cxl_add_memdev(cxlds);
 	if (IS_ERR(cxlmd))



[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