Skip to content

Commit 59fe202

Browse files
committed
Merge tag 'drm-intel-fixes-2023-08-24' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
- Fix power consumption at s2idle on DG2 (Anshuman) - Fix documentation build warning (Jani) - Fix Display HPD (Imre) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ZOdPRFSJpo0ErPX/@intel.com
2 parents ce22e89 + 1dcc437 commit 59fe202

File tree

5 files changed

+69
-39
lines changed

5 files changed

+69
-39
lines changed

drivers/gpu/drm/drm_probe_helper.c

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,26 @@ static bool drm_kms_helper_enable_hpd(struct drm_device *dev)
262262
}
263263

264264
#define DRM_OUTPUT_POLL_PERIOD (10*HZ)
265+
static void reschedule_output_poll_work(struct drm_device *dev)
266+
{
267+
unsigned long delay = DRM_OUTPUT_POLL_PERIOD;
268+
269+
if (dev->mode_config.delayed_event)
270+
/*
271+
* FIXME:
272+
*
273+
* Use short (1s) delay to handle the initial delayed event.
274+
* This delay should not be needed, but Optimus/nouveau will
275+
* fail in a mysterious way if the delayed event is handled as
276+
* soon as possible like it is done in
277+
* drm_helper_probe_single_connector_modes() in case the poll
278+
* was enabled before.
279+
*/
280+
delay = HZ;
281+
282+
schedule_delayed_work(&dev->mode_config.output_poll_work, delay);
283+
}
284+
265285
/**
266286
* drm_kms_helper_poll_enable - re-enable output polling.
267287
* @dev: drm_device
@@ -279,37 +299,41 @@ static bool drm_kms_helper_enable_hpd(struct drm_device *dev)
279299
*/
280300
void drm_kms_helper_poll_enable(struct drm_device *dev)
281301
{
282-
bool poll = false;
283-
unsigned long delay = DRM_OUTPUT_POLL_PERIOD;
284-
285302
if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll ||
286303
dev->mode_config.poll_running)
287304
return;
288305

289-
poll = drm_kms_helper_enable_hpd(dev);
290-
291-
if (dev->mode_config.delayed_event) {
292-
/*
293-
* FIXME:
294-
*
295-
* Use short (1s) delay to handle the initial delayed event.
296-
* This delay should not be needed, but Optimus/nouveau will
297-
* fail in a mysterious way if the delayed event is handled as
298-
* soon as possible like it is done in
299-
* drm_helper_probe_single_connector_modes() in case the poll
300-
* was enabled before.
301-
*/
302-
poll = true;
303-
delay = HZ;
304-
}
305-
306-
if (poll)
307-
schedule_delayed_work(&dev->mode_config.output_poll_work, delay);
306+
if (drm_kms_helper_enable_hpd(dev) ||
307+
dev->mode_config.delayed_event)
308+
reschedule_output_poll_work(dev);
308309

309310
dev->mode_config.poll_running = true;
310311
}
311312
EXPORT_SYMBOL(drm_kms_helper_poll_enable);
312313

314+
/**
315+
* drm_kms_helper_poll_reschedule - reschedule the output polling work
316+
* @dev: drm_device
317+
*
318+
* This function reschedules the output polling work, after polling for a
319+
* connector has been enabled.
320+
*
321+
* Drivers must call this helper after enabling polling for a connector by
322+
* setting %DRM_CONNECTOR_POLL_CONNECT / %DRM_CONNECTOR_POLL_DISCONNECT flags
323+
* in drm_connector::polled. Note that after disabling polling by clearing these
324+
* flags for a connector will stop the output polling work automatically if
325+
* the polling is disabled for all other connectors as well.
326+
*
327+
* The function can be called only after polling has been enabled by calling
328+
* drm_kms_helper_poll_init() / drm_kms_helper_poll_enable().
329+
*/
330+
void drm_kms_helper_poll_reschedule(struct drm_device *dev)
331+
{
332+
if (dev->mode_config.poll_running)
333+
reschedule_output_poll_work(dev);
334+
}
335+
EXPORT_SYMBOL(drm_kms_helper_poll_reschedule);
336+
313337
static enum drm_connector_status
314338
drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force)
315339
{

drivers/gpu/drm/i915/display/intel_hotplug.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ intel_hpd_irq_storm_switch_to_polling(struct drm_i915_private *dev_priv)
211211

212212
/* Enable polling and queue hotplug re-enabling. */
213213
if (hpd_disabled) {
214-
drm_kms_helper_poll_enable(&dev_priv->drm);
214+
drm_kms_helper_poll_reschedule(&dev_priv->drm);
215215
mod_delayed_work(dev_priv->unordered_wq,
216216
&dev_priv->display.hotplug.reenable_work,
217217
msecs_to_jiffies(HPD_STORM_REENABLE_DELAY));
@@ -649,7 +649,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
649649
drm_connector_list_iter_end(&conn_iter);
650650

651651
if (enabled)
652-
drm_kms_helper_poll_enable(&dev_priv->drm);
652+
drm_kms_helper_poll_reschedule(&dev_priv->drm);
653653

654654
mutex_unlock(&dev_priv->drm.mode_config.mutex);
655655

drivers/gpu/drm/i915/gt/uc/intel_huc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@
2626
* The kernel driver is only responsible for loading the HuC firmware and
2727
* triggering its security authentication. This is done differently depending
2828
* on the platform:
29+
*
2930
* - older platforms (from Gen9 to most Gen12s): the load is performed via DMA
3031
* and the authentication via GuC
3132
* - DG2: load and authentication are both performed via GSC.
3233
* - MTL and newer platforms: the load is performed via DMA (same as with
3334
* not-DG2 older platforms), while the authentication is done in 2-steps,
3435
* a first auth for clear-media workloads via GuC and a second one for all
3536
* workloads via GSC.
37+
*
3638
* On platforms where the GuC does the authentication, to correctly do so the
3739
* HuC binary must be loaded before the GuC one.
3840
* Loading the HuC is optional; however, not using the HuC might negatively

drivers/gpu/drm/i915/i915_driver.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@ static int i915_pcode_init(struct drm_i915_private *i915)
443443
static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
444444
{
445445
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
446-
struct pci_dev *root_pdev;
447446
int ret;
448447

449448
if (i915_inject_probe_failure(dev_priv))
@@ -557,15 +556,6 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
557556

558557
intel_bw_init_hw(dev_priv);
559558

560-
/*
561-
* FIXME: Temporary hammer to avoid freezing the machine on our DGFX
562-
* This should be totally removed when we handle the pci states properly
563-
* on runtime PM and on s2idle cases.
564-
*/
565-
root_pdev = pcie_find_root_port(pdev);
566-
if (root_pdev)
567-
pci_d3cold_disable(root_pdev);
568-
569559
return 0;
570560

571561
err_opregion:
@@ -591,18 +581,13 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
591581
static void i915_driver_hw_remove(struct drm_i915_private *dev_priv)
592582
{
593583
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
594-
struct pci_dev *root_pdev;
595584

596585
i915_perf_fini(dev_priv);
597586

598587
intel_opregion_cleanup(dev_priv);
599588

600589
if (pdev->msi_enabled)
601590
pci_disable_msi(pdev);
602-
603-
root_pdev = pcie_find_root_port(pdev);
604-
if (root_pdev)
605-
pci_d3cold_enable(root_pdev);
606591
}
607592

608593
/**
@@ -1517,6 +1502,8 @@ static int intel_runtime_suspend(struct device *kdev)
15171502
{
15181503
struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
15191504
struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
1505+
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
1506+
struct pci_dev *root_pdev;
15201507
struct intel_gt *gt;
15211508
int ret, i;
15221509

@@ -1568,6 +1555,15 @@ static int intel_runtime_suspend(struct device *kdev)
15681555
drm_err(&dev_priv->drm,
15691556
"Unclaimed access detected prior to suspending\n");
15701557

1558+
/*
1559+
* FIXME: Temporary hammer to avoid freezing the machine on our DGFX
1560+
* This should be totally removed when we handle the pci states properly
1561+
* on runtime PM.
1562+
*/
1563+
root_pdev = pcie_find_root_port(pdev);
1564+
if (root_pdev)
1565+
pci_d3cold_disable(root_pdev);
1566+
15711567
rpm->suspended = true;
15721568

15731569
/*
@@ -1606,6 +1602,8 @@ static int intel_runtime_resume(struct device *kdev)
16061602
{
16071603
struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
16081604
struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
1605+
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
1606+
struct pci_dev *root_pdev;
16091607
struct intel_gt *gt;
16101608
int ret, i;
16111609

@@ -1619,6 +1617,11 @@ static int intel_runtime_resume(struct device *kdev)
16191617

16201618
intel_opregion_notify_adapter(dev_priv, PCI_D0);
16211619
rpm->suspended = false;
1620+
1621+
root_pdev = pcie_find_root_port(pdev);
1622+
if (root_pdev)
1623+
pci_d3cold_enable(root_pdev);
1624+
16221625
if (intel_uncore_unclaimed_mmio(&dev_priv->uncore))
16231626
drm_dbg(&dev_priv->drm,
16241627
"Unclaimed access during suspend, bios?\n");

include/drm/drm_probe_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector);
2525

2626
void drm_kms_helper_poll_disable(struct drm_device *dev);
2727
void drm_kms_helper_poll_enable(struct drm_device *dev);
28+
void drm_kms_helper_poll_reschedule(struct drm_device *dev);
2829
bool drm_kms_helper_is_poll_worker(void);
2930

3031
enum drm_mode_status drm_crtc_helper_mode_valid_fixed(struct drm_crtc *crtc,

0 commit comments

Comments
 (0)