diff mbox

drm/radeon: avoid warnings from r600/eg irq handlers on powered off card.

Message ID 1308369591-12129-1-git-send-email-airlied@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Dave Airlie June 18, 2011, 3:59 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

Since we were calling the wptr function before checking if the IH was
even enabled, or the GPU wasn't shutdown, we'd get spam in the logs when
the GPU readback 0xffffffff. This reorders things so we return early
in the no IH and GPU shutdown cases.

Reported-and-tested-by: ManDay on #radeon
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/radeon/evergreen.c |   17 +++++++----------
 drivers/gpu/drm/radeon/r600.c      |   15 +++++++--------
 2 files changed, 14 insertions(+), 18 deletions(-)

Comments

Alex Deucher June 20, 2011, 1:53 a.m. UTC | #1
On Fri, Jun 17, 2011 at 11:59 PM, Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> Since we were calling the wptr function before checking if the IH was
> even enabled, or the GPU wasn't shutdown, we'd get spam in the logs when
> the GPU readback 0xffffffff. This reorders things so we return early
> in the no IH and GPU shutdown cases.
>
> Reported-and-tested-by: ManDay on #radeon
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Looks good.

Reviewed-by: Alex Deucher <alexdeucher@gmail.com>

> ---
>  drivers/gpu/drm/radeon/evergreen.c |   17 +++++++----------
>  drivers/gpu/drm/radeon/r600.c      |   15 +++++++--------
>  2 files changed, 14 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
> index 7e3d96e..7162b7b 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -2695,28 +2695,25 @@ static inline u32 evergreen_get_ih_wptr(struct radeon_device *rdev)
>
>  int evergreen_irq_process(struct radeon_device *rdev)
>  {
> -       u32 wptr = evergreen_get_ih_wptr(rdev);
> -       u32 rptr = rdev->ih.rptr;
> +       u32 wptr;
> +       u32 rptr;
>        u32 src_id, src_data;
>        u32 ring_index;
>        unsigned long flags;
>        bool queue_hotplug = false;
>
> -       DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
> -       if (!rdev->ih.enabled)
> +       if (!rdev->ih.enabled || rdev->shutdown)
>                return IRQ_NONE;
>
> -       spin_lock_irqsave(&rdev->ih.lock, flags);
> +       wptr = evergreen_get_ih_wptr(rdev);
> +       rptr = rdev->ih.rptr;
> +       DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
>
> +       spin_lock_irqsave(&rdev->ih.lock, flags);
>        if (rptr == wptr) {
>                spin_unlock_irqrestore(&rdev->ih.lock, flags);
>                return IRQ_NONE;
>        }
> -       if (rdev->shutdown) {
> -               spin_unlock_irqrestore(&rdev->ih.lock, flags);
> -               return IRQ_NONE;
> -       }
> -
>  restart_ih:
>        /* display interrupts */
>        evergreen_irq_ack(rdev);
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index 7dd45ca..dc9fde3 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -3294,27 +3294,26 @@ static inline u32 r600_get_ih_wptr(struct radeon_device *rdev)
>
>  int r600_irq_process(struct radeon_device *rdev)
>  {
> -       u32 wptr = r600_get_ih_wptr(rdev);
> -       u32 rptr = rdev->ih.rptr;
> +       u32 wptr;
> +       u32 rptr;
>        u32 src_id, src_data;
>        u32 ring_index;
>        unsigned long flags;
>        bool queue_hotplug = false;
>
> -       DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
> -       if (!rdev->ih.enabled)
> +       if (!rdev->ih.enabled || rdev->shutdown)
>                return IRQ_NONE;
>
> +       wptr = r600_get_ih_wptr(rdev);
> +       rptr = rdev->ih.rptr;
> +       DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
> +
>        spin_lock_irqsave(&rdev->ih.lock, flags);
>
>        if (rptr == wptr) {
>                spin_unlock_irqrestore(&rdev->ih.lock, flags);
>                return IRQ_NONE;
>        }
> -       if (rdev->shutdown) {
> -               spin_unlock_irqrestore(&rdev->ih.lock, flags);
> -               return IRQ_NONE;
> -       }
>
>  restart_ih:
>        /* display interrupts */
> --
> 1.7.5.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 7e3d96e..7162b7b 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2695,28 +2695,25 @@  static inline u32 evergreen_get_ih_wptr(struct radeon_device *rdev)
 
 int evergreen_irq_process(struct radeon_device *rdev)
 {
-	u32 wptr = evergreen_get_ih_wptr(rdev);
-	u32 rptr = rdev->ih.rptr;
+	u32 wptr;
+	u32 rptr;
 	u32 src_id, src_data;
 	u32 ring_index;
 	unsigned long flags;
 	bool queue_hotplug = false;
 
-	DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
-	if (!rdev->ih.enabled)
+	if (!rdev->ih.enabled || rdev->shutdown)
 		return IRQ_NONE;
 
-	spin_lock_irqsave(&rdev->ih.lock, flags);
+	wptr = evergreen_get_ih_wptr(rdev);
+	rptr = rdev->ih.rptr;
+	DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
 
+	spin_lock_irqsave(&rdev->ih.lock, flags);
 	if (rptr == wptr) {
 		spin_unlock_irqrestore(&rdev->ih.lock, flags);
 		return IRQ_NONE;
 	}
-	if (rdev->shutdown) {
-		spin_unlock_irqrestore(&rdev->ih.lock, flags);
-		return IRQ_NONE;
-	}
-
 restart_ih:
 	/* display interrupts */
 	evergreen_irq_ack(rdev);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 7dd45ca..dc9fde3 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -3294,27 +3294,26 @@  static inline u32 r600_get_ih_wptr(struct radeon_device *rdev)
 
 int r600_irq_process(struct radeon_device *rdev)
 {
-	u32 wptr = r600_get_ih_wptr(rdev);
-	u32 rptr = rdev->ih.rptr;
+	u32 wptr;
+	u32 rptr;
 	u32 src_id, src_data;
 	u32 ring_index;
 	unsigned long flags;
 	bool queue_hotplug = false;
 
-	DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
-	if (!rdev->ih.enabled)
+	if (!rdev->ih.enabled || rdev->shutdown)
 		return IRQ_NONE;
 
+	wptr = r600_get_ih_wptr(rdev);
+	rptr = rdev->ih.rptr;
+	DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr);
+
 	spin_lock_irqsave(&rdev->ih.lock, flags);
 
 	if (rptr == wptr) {
 		spin_unlock_irqrestore(&rdev->ih.lock, flags);
 		return IRQ_NONE;
 	}
-	if (rdev->shutdown) {
-		spin_unlock_irqrestore(&rdev->ih.lock, flags);
-		return IRQ_NONE;
-	}
 
 restart_ih:
 	/* display interrupts */