Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755712AbbLDIyL (ORCPT ); Fri, 4 Dec 2015 03:54:11 -0500 Received: from mail-bl2on0072.outbound.protection.outlook.com ([65.55.169.72]:49184 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755512AbbLDIyI (ORCPT ); Fri, 4 Dec 2015 03:54:08 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christian.Koenig@amd.com; Subject: Re: [PATCH v2] drm/radeon: Retry DDC probing on DVI on failure if we got an HPD interrupt To: , Alex Deucher , David Airlie , , References: <1449185167-6886-1-git-send-email-cpaul@redhat.com> CC: Jerome Glisse , Benjamin Tissoires From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <566154A0.5050205@amd.com> Date: Fri, 4 Dec 2015 09:53:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1449185167-6886-1-git-send-email-cpaul@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [2a02:908:f678:3641:99a8:73e6:8d03:9bcb] X-ClientProxiedBy: DB5PR06CA0034.eurprd06.prod.outlook.com (25.162.165.44) To DM2PR12MB0139.namprd12.prod.outlook.com (25.161.145.155) X-Microsoft-Exchange-Diagnostics: 1;DM2PR12MB0139;2:NiNeYpof+dtzCGig13Zs0EzQevysimCBnLrvIjd3vSRN+PCikFVGL5Rqb6QZgbuMwmMV1dUpN+RTausc82GfOBUvYxUt3WW4rUEOH/pr2E434RS/Jv/pQoeQbyyqroWJRawiSx3vQLLxtgqD4/Ch3w==;3:BXeBU70vNtW3DWDgSNGlHIXyRXFgd9Eiia5Av0WhMquyWJOAl38Y14F5UwlcshfZSePMZw3ES4VuECLB3DXsXKS8ZX126y/kAyp9ow4jRyJPiWAkkR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ej4UgqC9wzGRwLEDYrPi++eMT/gLVkq+MvsG6geTwmEtL+UaPy+HplLzNb1dKQqm8lYmxjKY9H76s96UJ3ATBpigzVPXVm9kyK/Ra73MqsVEO9ib1qfHD8jloynAHCeeHf/SZKpTTPaBKSsw4vkNEfL5A8Wo5wz0tEvsAzGq/9eNfQ/2fNi0UQ4Rd+7KLtI98rb2z4Alk3P7B3+lXgiuaNJ0mRezfkMkmDRLvCi2NE1TCul0FGLTxLy/0z4ft+A= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046);SRVR:DM2PR12MB0139;BCL:0;PCL:0;RULEID:;SRVR:DM2PR12MB0139; X-Forefront-PRVS: 07807C55DC X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(189002)(24454002)(199003)(64126003)(586003)(40100003)(99136001)(65956001)(65806001)(47776003)(5008740100001)(92566002)(87976001)(83506001)(5004730100002)(19580395003)(19580405001)(80316001)(2950100001)(77096005)(86362001)(575784001)(23746002)(2201001)(101416001)(65816999)(87266999)(54356999)(33656002)(76176999)(122386002)(50986999)(50466002)(59896002)(105586002)(106356001)(42186005)(1096002)(6116002)(1706002)(4001350100001)(97736004)(81156007)(5001770100001)(5001960100002)(189998001)(36756003)(3826002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR12MB0139;H:[IPv6:2a02:908:f678:3641:99a8:73e6:8d03:9bcb];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DM2PR12MB0139;23:lUrKEuo4Nu9dvmVlzKkqPFJuIp3Rd0nU1K60I?= =?Windows-1252?Q?w77gPcjavri4SlGa95P5883qcchanuF807NjKWBASZGSi6UY0uUlU4IE?= =?Windows-1252?Q?7GrxMMugCzfR+i1uw3xbta9Qu6sIskzrNkLSaSGbEtPw1hSlnXMfLJ7A?= =?Windows-1252?Q?nBfSUFFrU/HHxx0LsiY/+494sWYtu981AvTo7mYd2jqVR0/jAIwZJs1C?= =?Windows-1252?Q?0EABKvVrEFjMFOkYzhUwYPKul18lfZV6aW9rzccx0XGkbbGJT7UWjwAF?= =?Windows-1252?Q?9sNrOxymelSd4gSKSgquN0oOguEOK8wcH2/I4MfQDsRMtOKTTnVn3pyS?= =?Windows-1252?Q?9se7oZgE8m2kcSsMOVUzUBSdhx4sy9PFnuIuuLmbctnctTbGvLkklhBn?= =?Windows-1252?Q?UqB5JtCHUOwG3l/DSahC7j9/HPqrrQ8vVZoBwvy5rI8MLRpT49Ykgt7R?= =?Windows-1252?Q?20MptHdSRr8Y2sse0CvjlPUzzhvw7NxC05btFqa7frh/5zwR0HQ6swmn?= =?Windows-1252?Q?k8Ya+M+EEfGFV7FAEnHFv+Gi3VzwGPX9IC963nqIAP7kOeg3sM3havld?= =?Windows-1252?Q?7J3ARtu8eTzGmws2ZDYZ0K/xTWHfMTXr1sOiEjS0t7ldpFCHmVOsSBaO?= =?Windows-1252?Q?DG0NM7Dn4f0yp8Mbt2ONprvwF64epRnv+JXAMrafum8chvGgqXJWtETD?= =?Windows-1252?Q?R+z8tLKJFYvL4SGBC6NC2pzTM0lpsQW9aLOZdd6Hh1oA5bSsXnH1/8VY?= =?Windows-1252?Q?U0gFGfVEqiAfFRxZrmWd4AxLk7QrZoq4ikVMcCGC20eI44D9JNgD9KoZ?= =?Windows-1252?Q?ivpjFFI9J0F9u4jB8YOxLtxwlYwFrvgT77MsoQYhU1qJGGE8j1pPv6a+?= =?Windows-1252?Q?k2Cbm29oM1UF20axnEaQ5cQVUNDfyWteq4q2EY8OzpcVheUT8TvRvKVr?= =?Windows-1252?Q?J18aStE0XOMm0R/Rm8GtaWauhzTyzGdB2rLYX3kqFMPKTb1A5oOPrHlq?= =?Windows-1252?Q?7/4v4IBZNtH5RgkpubZxn9FH0NJ/HrUKOcJlAa9aJaQpbBXuwqJHfPiP?= =?Windows-1252?Q?hK7zbPGYoxz5bFltSh2iig9b9DNfycaAyFdM9IjZwQvX1kkVJDb+liLd?= =?Windows-1252?Q?esqSK4cKej5nYRLUlnONk7WpLdHzTRaO8Mz6vaXWn2H6avywh4GTldpi?= =?Windows-1252?Q?bqWimDJfE3EL2XBNSld0p4TH/N6ymbL2+rE517xgxdV4RQoUiJMaQ2E3?= =?Windows-1252?Q?LFY02YQBv4lHE+ljWtVy7TZzn7HjXNgO7/v4lXotABT0qYx6o2YABBQ+?= =?Windows-1252?Q?LtThNptdH4bmxsY31hIAZK1124xoGQ1TzBlfqwaN3hYO9b68cI8rWiUx?= =?Windows-1252?Q?uqfA15zU/qj?= X-Microsoft-Exchange-Diagnostics: 1;DM2PR12MB0139;5:Aph/si4TGIz+AMidMfXHU8ipgO3kAcrBHynwtIp+BrvB+GyEwQ5x08DmjKcwNP544qh2yywY/yKJjJ4W3B44gOZWq1xYfeXrWEP2L1bxJu+IuXASgFR4LiRjnM0heZcOV80JbstTqcTZVqH9SpT21Q==;24:N3UjaLSODUG0+bufr9onw2bPReBr3DTFnfBgdc4nBOQmxzdyY6q5hgo6iFOhkO0tFTWkWsxDpMjW2PfBfPQmrr0F4jpej0tzXu0nM4Yi/l8=;20:3trr5ia6FQcSwpmAM/lu3nHlPkcex7VYHq6b77xk+0fUp2Xwtr/O4WRbKNKlqqXjkntoc9mdaCPhJwVURLlnonLiQsQM0v35tfU2HwVdmBpDQoh1Tu4vWvb3AAMThYAOQ4AQ899dT1LGfkaZpoHnCltGP/rqD7evQ5G4cJ+rF7wH2n/BTOkubJlZafc8XaS4BmJTO9QKK0sAEZO71g8aW8gEkHMfmLR1LgfxtIprh+BxC2wvvwM1tsoVFVvUUpFK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2015 08:54:03.3947 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0139 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9380 Lines: 229 On 04.12.2015 00:26, cpaul@redhat.com wrote: > From: Lyude > > HPD signals on DVI ports can be fired off before the pins required for > DDC probing actually make contact, due to the pins for HPD making > contact first. This results in a HPD signal being asserted but DDC > probing failing, resulting in hotplugging occasionally failing. > > This is somewhat rare on most cards (depending on what angle you plug > the DVI connector in), but on some cards it happens constantly. The > Radeon R5 on the machine used for testing this patch for instance, runs > into this issue just about every time I try to hotplug a DVI monitor and > as a result hotplugging almost never works. > > Rescheduling the hotplug work for a second when we run into an HPD > signal with a failing DDC probe usually gives enough time for the rest > of the connector's pins to make contact, and fixes this issue. > > Signed-off-by: Lyude I find a second a bit long, but if it works so what? Looks sane enough to me, patch is Reviewed-by: Christian K?nig > --- > Sending this version of the patch because Jerome says this will probably be the > least controversial of the potential fixes. Instead of sending userspace tons of > hotplug events, we just reschedule the hotplug work. > > drivers/gpu/drm/radeon/cik.c | 2 +- > drivers/gpu/drm/radeon/evergreen.c | 2 +- > drivers/gpu/drm/radeon/r100.c | 2 +- > drivers/gpu/drm/radeon/r600.c | 2 +- > drivers/gpu/drm/radeon/radeon.h | 2 +- > drivers/gpu/drm/radeon/radeon_connectors.c | 21 ++++++++++++++++++++- > drivers/gpu/drm/radeon/radeon_irq_kms.c | 8 ++++---- > drivers/gpu/drm/radeon/radeon_mode.h | 1 + > drivers/gpu/drm/radeon/rs600.c | 2 +- > drivers/gpu/drm/radeon/si.c | 2 +- > 10 files changed, 32 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c > index 248953d..6801a0c 100644 > --- a/drivers/gpu/drm/radeon/cik.c > +++ b/drivers/gpu/drm/radeon/cik.c > @@ -8472,7 +8472,7 @@ restart_ih: > if (queue_dp) > schedule_work(&rdev->dp_work); > if (queue_hotplug) > - schedule_work(&rdev->hotplug_work); > + schedule_delayed_work(&rdev->hotplug_work, 0); > if (queue_reset) { > rdev->needs_reset = true; > wake_up_all(&rdev->fence_queue); > diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c > index 0acde19..f8e4986 100644 > --- a/drivers/gpu/drm/radeon/evergreen.c > +++ b/drivers/gpu/drm/radeon/evergreen.c > @@ -5368,7 +5368,7 @@ restart_ih: > if (queue_dp) > schedule_work(&rdev->dp_work); > if (queue_hotplug) > - schedule_work(&rdev->hotplug_work); > + schedule_delayed_work(&rdev->hotplug_work, 0); > if (queue_hdmi) > schedule_work(&rdev->audio_work); > if (queue_thermal && rdev->pm.dpm_enabled) > diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c > index 238b13f..2df3c86 100644 > --- a/drivers/gpu/drm/radeon/r100.c > +++ b/drivers/gpu/drm/radeon/r100.c > @@ -806,7 +806,7 @@ int r100_irq_process(struct radeon_device *rdev) > status = r100_irq_ack(rdev); > } > if (queue_hotplug) > - schedule_work(&rdev->hotplug_work); > + schedule_delayed_work(&rdev->hotplug_work, 0); > if (rdev->msi_enabled) { > switch (rdev->family) { > case CHIP_RS400: > diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c > index 4ea5b10..cc2fdf0 100644 > --- a/drivers/gpu/drm/radeon/r600.c > +++ b/drivers/gpu/drm/radeon/r600.c > @@ -4276,7 +4276,7 @@ restart_ih: > WREG32(IH_RB_RPTR, rptr); > } > if (queue_hotplug) > - schedule_work(&rdev->hotplug_work); > + schedule_delayed_work(&rdev->hotplug_work, 0); > if (queue_hdmi) > schedule_work(&rdev->audio_work); > if (queue_thermal && rdev->pm.dpm_enabled) > diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h > index b6cbd81..87db649 100644 > --- a/drivers/gpu/drm/radeon/radeon.h > +++ b/drivers/gpu/drm/radeon/radeon.h > @@ -2414,7 +2414,7 @@ struct radeon_device { > struct r600_ih ih; /* r6/700 interrupt ring */ > struct radeon_rlc rlc; > struct radeon_mec mec; > - struct work_struct hotplug_work; > + struct delayed_work hotplug_work; > struct work_struct dp_work; > struct work_struct audio_work; > int num_crtc; /* number of crtcs */ > diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c > index 5a2cafb..340f3f5 100644 > --- a/drivers/gpu/drm/radeon/radeon_connectors.c > +++ b/drivers/gpu/drm/radeon/radeon_connectors.c > @@ -1234,13 +1234,32 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) > if (r < 0) > return connector_status_disconnected; > > + if (radeon_connector->detected_hpd_without_ddc) { > + force = true; > + radeon_connector->detected_hpd_without_ddc = false; > + } > + > if (!force && radeon_check_hpd_status_unchanged(connector)) { > ret = connector->status; > goto exit; > } > > - if (radeon_connector->ddc_bus) > + if (radeon_connector->ddc_bus) { > dret = radeon_ddc_probe(radeon_connector, false); > + > + /* Sometimes the pins required for the DDC probe on DVI > + * connectors don't make contact at the same time that the ones > + * for HPD do. If the DDC probe fails even though we had an HPD > + * signal, try again later */ > + if (!dret && !force && > + connector->status != connector_status_connected) { > + DRM_DEBUG_KMS("hpd detected without ddc, retrying in 1 second\n"); > + radeon_connector->detected_hpd_without_ddc = true; > + schedule_delayed_work(&rdev->hotplug_work, > + msecs_to_jiffies(1000)); > + goto exit; > + } > + } > if (dret) { > radeon_connector->detected_by_load = false; > radeon_connector_free_edid(connector); > diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c > index 171d3e4..979f3bf 100644 > --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c > +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c > @@ -74,7 +74,7 @@ irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg) > static void radeon_hotplug_work_func(struct work_struct *work) > { > struct radeon_device *rdev = container_of(work, struct radeon_device, > - hotplug_work); > + hotplug_work.work); > struct drm_device *dev = rdev->ddev; > struct drm_mode_config *mode_config = &dev->mode_config; > struct drm_connector *connector; > @@ -302,7 +302,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) > } > } > > - INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func); > + INIT_DELAYED_WORK(&rdev->hotplug_work, radeon_hotplug_work_func); > INIT_WORK(&rdev->dp_work, radeon_dp_work_func); > INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi); > > @@ -310,7 +310,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) > r = drm_irq_install(rdev->ddev, rdev->ddev->pdev->irq); > if (r) { > rdev->irq.installed = false; > - flush_work(&rdev->hotplug_work); > + flush_delayed_work(&rdev->hotplug_work); > return r; > } > > @@ -333,7 +333,7 @@ void radeon_irq_kms_fini(struct radeon_device *rdev) > rdev->irq.installed = false; > if (rdev->msi_enabled) > pci_disable_msi(rdev->pdev); > - flush_work(&rdev->hotplug_work); > + flush_delayed_work(&rdev->hotplug_work); > } > } > > diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h > index 457b026..0aeb3ee 100644 > --- a/drivers/gpu/drm/radeon/radeon_mode.h > +++ b/drivers/gpu/drm/radeon/radeon_mode.h > @@ -553,6 +553,7 @@ struct radeon_connector { > void *con_priv; > bool dac_load_detect; > bool detected_by_load; /* if the connection status was determined by load */ > + bool detected_hpd_without_ddc; /* if an HPD signal was detected on DVI, but ddc probing failed */ > uint16_t connector_object_id; > struct radeon_hpd hpd; > struct radeon_router router; > diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c > index 97a9048..6244f4e 100644 > --- a/drivers/gpu/drm/radeon/rs600.c > +++ b/drivers/gpu/drm/radeon/rs600.c > @@ -813,7 +813,7 @@ int rs600_irq_process(struct radeon_device *rdev) > status = rs600_irq_ack(rdev); > } > if (queue_hotplug) > - schedule_work(&rdev->hotplug_work); > + schedule_delayed_work(&rdev->hotplug_work, 0); > if (queue_hdmi) > schedule_work(&rdev->audio_work); > if (rdev->msi_enabled) { > diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c > index 07037e3..fb1a7ec 100644 > --- a/drivers/gpu/drm/radeon/si.c > +++ b/drivers/gpu/drm/radeon/si.c > @@ -6848,7 +6848,7 @@ restart_ih: > if (queue_dp) > schedule_work(&rdev->dp_work); > if (queue_hotplug) > - schedule_work(&rdev->hotplug_work); > + schedule_delayed_work(&rdev->hotplug_work, 0); > if (queue_thermal && rdev->pm.dpm_enabled) > schedule_work(&rdev->pm.dpm.thermal.work); > rdev->ih.rptr = rptr; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/