diff mbox series

[v1,21/29] cxl/region: Lock decoders that need address translation

Message ID 20250107141015.3367194-22-rrichter@amd.com
State New
Headers show
Series cxl: Add address translation support and enable AMD Zen5 platforms | expand

Commit Message

Robert Richter Jan. 7, 2025, 2:10 p.m. UTC
There is only support to translate from the endpoint to its parent
port, but not in the opposite direction from the parent to the
endpoint. Thus, the endpoint address range cannot be determined and
setup manually. If the parent implements the ->to_hpa() callback and
needs address translation, forbit reprogramming of the decoders and
lock them.

Signed-off-by: Robert Richter <rrichter@amd.com>
---
 drivers/cxl/core/region.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Gregory Price Jan. 7, 2025, 10:35 p.m. UTC | #1
On Tue, Jan 07, 2025 at 03:10:07PM +0100, Robert Richter wrote:
> There is only support to translate from the endpoint to its parent
> port, but not in the opposite direction from the parent to the
> endpoint. Thus, the endpoint address range cannot be determined and
> setup manually. If the parent implements the ->to_hpa() callback and
> needs address translation, forbit reprogramming of the decoders and
                             ^^^^^^
                             forbid?

> lock them.
> 
> Signed-off-by: Robert Richter <rrichter@amd.com>
> ---
>  drivers/cxl/core/region.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 8d7893878362..681c26abc26e 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -3353,6 +3353,17 @@ static int cxl_endpoint_initialize(struct cxl_endpoint_decoder *cxled)
>  		if (cxl_port_calc_hpa(parent, cxld, &hpa))
>  			return -ENXIO;
>  
> +		/*
> +		 * There is only support to translate from the endpoint to its
> +		 * parent port, but not in the opposite direction from the
> +		 * parent to the endpoint. Thus, the endpoint address range
> +		 * cannot be determined and setup manually. If the parent
> +		 * implements the ->to_hpa() callback and needs address
> +		 * translation, forbit reprogramming of the decoders and lock
                                ^^^^^^
                                forbid?

> +		 * them.
> +		 */
> +		cxld->flags |= CXL_DECODER_F_LOCK;
> +
>  		/* Iterate from endpoint to root_port refining the position */
>  		pos = cxl_port_calc_pos(iter, &hpa, pos);
>  		if (pos < 0)
> -- 
> 2.39.5
>
diff mbox series

Patch

diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 8d7893878362..681c26abc26e 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -3353,6 +3353,17 @@  static int cxl_endpoint_initialize(struct cxl_endpoint_decoder *cxled)
 		if (cxl_port_calc_hpa(parent, cxld, &hpa))
 			return -ENXIO;
 
+		/*
+		 * There is only support to translate from the endpoint to its
+		 * parent port, but not in the opposite direction from the
+		 * parent to the endpoint. Thus, the endpoint address range
+		 * cannot be determined and setup manually. If the parent
+		 * implements the ->to_hpa() callback and needs address
+		 * translation, forbit reprogramming of the decoders and lock
+		 * them.
+		 */
+		cxld->flags |= CXL_DECODER_F_LOCK;
+
 		/* Iterate from endpoint to root_port refining the position */
 		pos = cxl_port_calc_pos(iter, &hpa, pos);
 		if (pos < 0)