Re: [PATCH] drm/radeon: Unbreak HPD handling for r600+

From: Lyude Paul
Date: Mon May 15 2017 - 10:20:04 EST


Mind giving me this a poke when this gets pushed upstream btw?

On Fri, 2017-05-12 at 08:56 +0200, Christian KÃnig wrote:
> Am 12.05.2017 um 01:31 schrieb Lyude:
> > We end up reading the interrupt register for HPD5, and then writing
> > it
> > to HPD6 which on systems without anything using HPD5 results in
> > permanently disabling hotplug on one of the display outputs after
> > the
> > first time we acknowledge a hotplug interrupt from the GPU.
> >
> > This code is really bad. But for now, let's just fix this. I will
> > hopefully have a large patch series to refactor all of this soon.
> >
> > Signed-off-by: Lyude <lyude@xxxxxxxxxx>
> > Cc: stable@xxxxxxxxxxxxxxx
>
> Really nice catch! And yes I agree the copy&pasted code in HPD
> handlingÂ
> always scared me as well.
>
> Patch is Reviewed-by: Christian KÃnig <christian.koenig@xxxxxxx>.
>
> Christian.
>
> > ---
> > Â drivers/gpu/drm/radeon/cik.cÂÂÂÂÂÂÂ| 4 ++--
> > Â drivers/gpu/drm/radeon/evergreen.c | 4 ++--
> > Â drivers/gpu/drm/radeon/r600.cÂÂÂÂÂÂ| 2 +-
> > Â drivers/gpu/drm/radeon/si.cÂÂÂÂÂÂÂÂ| 4 ++--
> > Â 4 files changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/cik.c
> > b/drivers/gpu/drm/radeon/cik.c
> > index 53710dd..cfc917c 100644
> > --- a/drivers/gpu/drm/radeon/cik.c
> > +++ b/drivers/gpu/drm/radeon/cik.c
> > @@ -7401,7 +7401,7 @@ static inline void cik_irq_ack(struct
> > radeon_device *rdev)
> > ÂÂ WREG32(DC_HPD5_INT_CONTROL, tmp);
> > ÂÂ }
> > ÂÂ if (rdev->irq.stat_regs.cik.disp_int_cont5 &
> > DC_HPD6_INTERRUPT) {
> > - tmp = RREG32(DC_HPD5_INT_CONTROL);
> > + tmp = RREG32(DC_HPD6_INT_CONTROL);
> > ÂÂ tmp |= DC_HPDx_INT_ACK;
> > ÂÂ WREG32(DC_HPD6_INT_CONTROL, tmp);
> > ÂÂ }
> > @@ -7431,7 +7431,7 @@ static inline void cik_irq_ack(struct
> > radeon_device *rdev)
> > ÂÂ WREG32(DC_HPD5_INT_CONTROL, tmp);
> > ÂÂ }
> > ÂÂ if (rdev->irq.stat_regs.cik.disp_int_cont5 &
> > DC_HPD6_RX_INTERRUPT) {
> > - tmp = RREG32(DC_HPD5_INT_CONTROL);
> > + tmp = RREG32(DC_HPD6_INT_CONTROL);
> > ÂÂ tmp |= DC_HPDx_RX_INT_ACK;
> > ÂÂ WREG32(DC_HPD6_INT_CONTROL, tmp);
> > ÂÂ }
> > diff --git a/drivers/gpu/drm/radeon/evergreen.c
> > b/drivers/gpu/drm/radeon/evergreen.c
> > index d1b1e0c..c48d19e 100644
> > --- a/drivers/gpu/drm/radeon/evergreen.c
> > +++ b/drivers/gpu/drm/radeon/evergreen.c
> > @@ -4933,7 +4933,7 @@ static void evergreen_irq_ack(struct
> > radeon_device *rdev)
> > ÂÂ WREG32(DC_HPD5_INT_CONTROL, tmp);
> > ÂÂ }
> > ÂÂ if (rdev->irq.stat_regs.evergreen.disp_int_cont5 &
> > DC_HPD6_INTERRUPT) {
> > - tmp = RREG32(DC_HPD5_INT_CONTROL);
> > + tmp = RREG32(DC_HPD6_INT_CONTROL);
> > ÂÂ tmp |= DC_HPDx_INT_ACK;
> > ÂÂ WREG32(DC_HPD6_INT_CONTROL, tmp);
> > ÂÂ }
> > @@ -4964,7 +4964,7 @@ static void evergreen_irq_ack(struct
> > radeon_device *rdev)
> > ÂÂ WREG32(DC_HPD5_INT_CONTROL, tmp);
> > ÂÂ }
> > ÂÂ if (rdev->irq.stat_regs.evergreen.disp_int_cont5 &
> > DC_HPD6_RX_INTERRUPT) {
> > - tmp = RREG32(DC_HPD5_INT_CONTROL);
> > + tmp = RREG32(DC_HPD6_INT_CONTROL);
> > ÂÂ tmp |= DC_HPDx_RX_INT_ACK;
> > ÂÂ WREG32(DC_HPD6_INT_CONTROL, tmp);
> > ÂÂ }
> > diff --git a/drivers/gpu/drm/radeon/r600.c
> > b/drivers/gpu/drm/radeon/r600.c
> > index 0a08517..e06e2d8 100644
> > --- a/drivers/gpu/drm/radeon/r600.c
> > +++ b/drivers/gpu/drm/radeon/r600.c
> > @@ -3988,7 +3988,7 @@ static void r600_irq_ack(struct radeon_device
> > *rdev)
> > ÂÂ WREG32(DC_HPD5_INT_CONTROL, tmp);
> > ÂÂ }
> > ÂÂ if (rdev->irq.stat_regs.r600.disp_int_cont2 &
> > DC_HPD6_INTERRUPT) {
> > - tmp = RREG32(DC_HPD5_INT_CONTROL);
> > + tmp = RREG32(DC_HPD6_INT_CONTROL);
> > ÂÂ tmp |= DC_HPDx_INT_ACK;
> > ÂÂ WREG32(DC_HPD6_INT_CONTROL, tmp);
> > ÂÂ }
> > diff --git a/drivers/gpu/drm/radeon/si.c
> > b/drivers/gpu/drm/radeon/si.c
> > index 528e5a4..bfeb774 100644
> > --- a/drivers/gpu/drm/radeon/si.c
> > +++ b/drivers/gpu/drm/radeon/si.c
> > @@ -6330,7 +6330,7 @@ static inline void si_irq_ack(struct
> > radeon_device *rdev)
> > ÂÂ WREG32(DC_HPD5_INT_CONTROL, tmp);
> > ÂÂ }
> > ÂÂ if (rdev->irq.stat_regs.evergreen.disp_int_cont5 &
> > DC_HPD6_INTERRUPT) {
> > - tmp = RREG32(DC_HPD5_INT_CONTROL);
> > + tmp = RREG32(DC_HPD6_INT_CONTROL);
> > ÂÂ tmp |= DC_HPDx_INT_ACK;
> > ÂÂ WREG32(DC_HPD6_INT_CONTROL, tmp);
> > ÂÂ }
> > @@ -6361,7 +6361,7 @@ static inline void si_irq_ack(struct
> > radeon_device *rdev)
> > ÂÂ WREG32(DC_HPD5_INT_CONTROL, tmp);
> > ÂÂ }
> > ÂÂ if (rdev->irq.stat_regs.evergreen.disp_int_cont5 &
> > DC_HPD6_RX_INTERRUPT) {
> > - tmp = RREG32(DC_HPD5_INT_CONTROL);
> > + tmp = RREG32(DC_HPD6_INT_CONTROL);
> > ÂÂ tmp |= DC_HPDx_RX_INT_ACK;
> > ÂÂ WREG32(DC_HPD6_INT_CONTROL, tmp);
> > ÂÂ }
>
>