]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cxl/pci: Delay event buffer allocation
authorIra Weiny <ira.weiny@intel.com>
Thu, 7 Nov 2024 20:58:22 +0000 (14:58 -0600)
committerDave Jiang <dave.jiang@intel.com>
Fri, 8 Nov 2024 16:39:05 +0000 (09:39 -0700)
The event buffer does not need to be allocated if something has failed in
setting up event irq's.

In prep for adjusting event configuration for DCD events move the buffer
allocation to the end of the event configuration.

Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Reviewed-by: Li Ming <ming4.li@intel.com>
Link: https://lore.kernel.org/all/663922b475e50_d54d72945b@dwillia2-xfh.jf.intel.com.notmuch/
Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Link: https://patch.msgid.link/20241107-dcd-type2-upstream-v7-4-56a84e66bc36@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/pci.c

index 188412d45e0d266b19f7401a1cdc51ed6fb0ea0a..295779c433b2a2e377995b53a70ff2a3158b0a8e 100644 (file)
@@ -764,10 +764,6 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge,
                return 0;
        }
 
-       rc = cxl_mem_alloc_event_buf(mds);
-       if (rc)
-               return rc;
-
        rc = cxl_event_get_int_policy(mds, &policy);
        if (rc)
                return rc;
@@ -781,6 +777,10 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge,
                return -EBUSY;
        }
 
+       rc = cxl_mem_alloc_event_buf(mds);
+       if (rc)
+               return rc;
+
        rc = cxl_event_irqsetup(mds);
        if (rc)
                return rc;