[PATCH 11/26] cxl/pci: Delay event buffer allocation

ira.weiny@intel.com posted 26 patches 1 year, 10 months ago
There is a newer version of this series
[PATCH 11/26] cxl/pci: Delay event buffer allocation
Posted by Ira Weiny 1 year, 10 months ago
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.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 drivers/cxl/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index cedd9b05f129..ccaf4ad26a4f 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -756,10 +756,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;
@@ -777,6 +773,10 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge,
 	if (rc)
 		return rc;
 
+	rc = cxl_mem_alloc_event_buf(mds);
+	if (rc)
+		return rc;
+
 	rc = cxl_event_irqsetup(mds, &policy);
 	if (rc)
 		return rc;

-- 
2.44.0
Re: [PATCH 11/26] cxl/pci: Delay event buffer allocation
Posted by Jonathan Cameron 1 year, 10 months ago
On Sun, 24 Mar 2024 16:18:14 -0700
Ira Weiny <ira.weiny@intel.com> wrote:

> 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.
> 
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Re: [PATCH 11/26] cxl/pci: Delay event buffer allocation
Posted by Dave Jiang 1 year, 10 months ago

On 3/24/24 4:18 PM, Ira Weiny wrote:
> 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.
> 
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/cxl/pci.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index cedd9b05f129..ccaf4ad26a4f 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -756,10 +756,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;
> @@ -777,6 +773,10 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge,
>  	if (rc)
>  		return rc;
>  
> +	rc = cxl_mem_alloc_event_buf(mds);
> +	if (rc)
> +		return rc;
> +
>  	rc = cxl_event_irqsetup(mds, &policy);
>  	if (rc)
>  		return rc;
>
Re: [PATCH 11/26] cxl/pci: Delay event buffer allocation
Posted by Davidlohr Bueso 1 year, 10 months ago
On Sun, 24 Mar 2024, Ira Weiny wrote:

>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.

The above could be removed and just picked up independet of dcd.

Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>

>
>Signed-off-by: Ira Weiny <ira.weiny@intel.com>
>---
> drivers/cxl/pci.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
>index cedd9b05f129..ccaf4ad26a4f 100644
>--- a/drivers/cxl/pci.c
>+++ b/drivers/cxl/pci.c
>@@ -756,10 +756,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;
>@@ -777,6 +773,10 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge,
>	if (rc)
>		return rc;
>
>+	rc = cxl_mem_alloc_event_buf(mds);
>+	if (rc)
>+		return rc;
>+
>	rc = cxl_event_irqsetup(mds, &policy);
>	if (rc)
>		return rc;
>
>--
>2.44.0
>