diff mbox series

[1/2] nouveau: handle EBUSY and EAGAIN for GSP aux errors.

Message ID 20241111034126.2028401-1-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] nouveau: handle EBUSY and EAGAIN for GSP aux errors. | expand

Commit Message

Dave Airlie Nov. 11, 2024, 3:41 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

The upper layer transfer functions expect EBUSY as a return
for when retries should be done.

Fix the AUX error translation, but also check for both errors
in a few places.

Fixes: eb284f4b3781 ("drm/nouveau/dp: Honor GSP link training retry timeouts")
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c | 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Lyude Paul Nov. 12, 2024, 11:08 p.m. UTC | #1
Reviewed-by: Lyude Paul <lyude@redhat.com>

On Mon, 2024-11-11 at 13:41 +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> The upper layer transfer functions expect EBUSY as a return
> for when retries should be done.
> 
> Fix the AUX error translation, but also check for both errors
> in a few places.
> 
> Fixes: eb284f4b3781 ("drm/nouveau/dp: Honor GSP link training retry timeouts")
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c | 2 +-
>  drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c  | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
> index 027867c2a8c5..8f9aa3463c3c 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
> @@ -992,7 +992,7 @@ r535_dp_train_target(struct nvkm_outp *outp, u8 target, bool mst, u8 link_nr, u8
>  		ctrl->data = data;
>  
>  		ret = nvkm_gsp_rm_ctrl_push(&disp->rm.objcom, &ctrl, sizeof(*ctrl));
> -		if (ret == -EAGAIN && ctrl->retryTimeMs) {
> +		if ((ret == -EAGAIN || ret == -EBUSY) && ctrl->retryTimeMs) {
>  			/*
>  			 * Device (likely an eDP panel) isn't ready yet, wait for the time specified
>  			 * by GSP before retrying again
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
> index cf58f9da9139..d586aea30898 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
> @@ -78,7 +78,7 @@ r535_rpc_status_to_errno(uint32_t rpc_status)
>  	switch (rpc_status) {
>  	case 0x55: /* NV_ERR_NOT_READY */
>  	case 0x66: /* NV_ERR_TIMEOUT_RETRY */
> -		return -EAGAIN;
> +		return -EBUSY;
>  	case 0x51: /* NV_ERR_NO_MEMORY */
>  		return -ENOMEM;
>  	default:
> @@ -601,7 +601,7 @@ r535_gsp_rpc_rm_alloc_push(struct nvkm_gsp_object *object, void *argv, u32 repc)
>  
>  	if (rpc->status) {
>  		ret = ERR_PTR(r535_rpc_status_to_errno(rpc->status));
> -		if (PTR_ERR(ret) != -EAGAIN)
> +		if (PTR_ERR(ret) != -EAGAIN && PTR_ERR(ret) != -EBUSY)
>  			nvkm_error(&gsp->subdev, "RM_ALLOC: 0x%x\n", rpc->status);
>  	} else {
>  		ret = repc ? rpc->params : NULL;
> @@ -660,7 +660,7 @@ r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object *object, void **argv, u32 repc)
>  
>  	if (rpc->status) {
>  		ret = r535_rpc_status_to_errno(rpc->status);
> -		if (ret != -EAGAIN)
> +		if (ret != -EAGAIN && ret != -EBUSY)
>  			nvkm_error(&gsp->subdev, "cli:0x%08x obj:0x%08x ctrl cmd:0x%08x failed: 0x%08x\n",
>  				   object->client->object.handle, object->handle, rpc->cmd, rpc->status);
>  	}
Philipp Stanner Nov. 13, 2024, 10:59 a.m. UTC | #2
On Mon, 2024-11-11 at 13:41 +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> The upper layer transfer functions expect EBUSY as a return
> for when retries should be done.
> 
> Fix the AUX error translation, but also check for both errors
> in a few places.
> 
> Fixes: eb284f4b3781 ("drm/nouveau/dp: Honor GSP link training retry
> timeouts")

Tags for stable kernel skipped on purpose in this series?

Regards,
P.

> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c | 2 +-
>  drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c  | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
> b/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
> index 027867c2a8c5..8f9aa3463c3c 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
> @@ -992,7 +992,7 @@ r535_dp_train_target(struct nvkm_outp *outp, u8
> target, bool mst, u8 link_nr, u8
>  		ctrl->data = data;
>  
>  		ret = nvkm_gsp_rm_ctrl_push(&disp->rm.objcom, &ctrl,
> sizeof(*ctrl));
> -		if (ret == -EAGAIN && ctrl->retryTimeMs) {
> +		if ((ret == -EAGAIN || ret == -EBUSY) && ctrl-
> >retryTimeMs) {
>  			/*
>  			 * Device (likely an eDP panel) isn't ready
> yet, wait for the time specified
>  			 * by GSP before retrying again
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
> b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
> index cf58f9da9139..d586aea30898 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
> @@ -78,7 +78,7 @@ r535_rpc_status_to_errno(uint32_t rpc_status)
>  	switch (rpc_status) {
>  	case 0x55: /* NV_ERR_NOT_READY */
>  	case 0x66: /* NV_ERR_TIMEOUT_RETRY */
> -		return -EAGAIN;
> +		return -EBUSY;
>  	case 0x51: /* NV_ERR_NO_MEMORY */
>  		return -ENOMEM;
>  	default:
> @@ -601,7 +601,7 @@ r535_gsp_rpc_rm_alloc_push(struct nvkm_gsp_object
> *object, void *argv, u32 repc)
>  
>  	if (rpc->status) {
>  		ret = ERR_PTR(r535_rpc_status_to_errno(rpc-
> >status));
> -		if (PTR_ERR(ret) != -EAGAIN)
> +		if (PTR_ERR(ret) != -EAGAIN && PTR_ERR(ret) != -
> EBUSY)
>  			nvkm_error(&gsp->subdev, "RM_ALLOC: 0x%x\n",
> rpc->status);
>  	} else {
>  		ret = repc ? rpc->params : NULL;
> @@ -660,7 +660,7 @@ r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object
> *object, void **argv, u32 repc)
>  
>  	if (rpc->status) {
>  		ret = r535_rpc_status_to_errno(rpc->status);
> -		if (ret != -EAGAIN)
> +		if (ret != -EAGAIN && ret != -EBUSY)
>  			nvkm_error(&gsp->subdev, "cli:0x%08x
> obj:0x%08x ctrl cmd:0x%08x failed: 0x%08x\n",
>  				   object->client->object.handle,
> object->handle, rpc->cmd, rpc->status);
>  	}
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
index 027867c2a8c5..8f9aa3463c3c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
@@ -992,7 +992,7 @@  r535_dp_train_target(struct nvkm_outp *outp, u8 target, bool mst, u8 link_nr, u8
 		ctrl->data = data;
 
 		ret = nvkm_gsp_rm_ctrl_push(&disp->rm.objcom, &ctrl, sizeof(*ctrl));
-		if (ret == -EAGAIN && ctrl->retryTimeMs) {
+		if ((ret == -EAGAIN || ret == -EBUSY) && ctrl->retryTimeMs) {
 			/*
 			 * Device (likely an eDP panel) isn't ready yet, wait for the time specified
 			 * by GSP before retrying again
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
index cf58f9da9139..d586aea30898 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
@@ -78,7 +78,7 @@  r535_rpc_status_to_errno(uint32_t rpc_status)
 	switch (rpc_status) {
 	case 0x55: /* NV_ERR_NOT_READY */
 	case 0x66: /* NV_ERR_TIMEOUT_RETRY */
-		return -EAGAIN;
+		return -EBUSY;
 	case 0x51: /* NV_ERR_NO_MEMORY */
 		return -ENOMEM;
 	default:
@@ -601,7 +601,7 @@  r535_gsp_rpc_rm_alloc_push(struct nvkm_gsp_object *object, void *argv, u32 repc)
 
 	if (rpc->status) {
 		ret = ERR_PTR(r535_rpc_status_to_errno(rpc->status));
-		if (PTR_ERR(ret) != -EAGAIN)
+		if (PTR_ERR(ret) != -EAGAIN && PTR_ERR(ret) != -EBUSY)
 			nvkm_error(&gsp->subdev, "RM_ALLOC: 0x%x\n", rpc->status);
 	} else {
 		ret = repc ? rpc->params : NULL;
@@ -660,7 +660,7 @@  r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object *object, void **argv, u32 repc)
 
 	if (rpc->status) {
 		ret = r535_rpc_status_to_errno(rpc->status);
-		if (ret != -EAGAIN)
+		if (ret != -EAGAIN && ret != -EBUSY)
 			nvkm_error(&gsp->subdev, "cli:0x%08x obj:0x%08x ctrl cmd:0x%08x failed: 0x%08x\n",
 				   object->client->object.handle, object->handle, rpc->cmd, rpc->status);
 	}