drm/xe: Enable PCI device earlier
authorMatt Roper <matthew.d.roper@intel.com>
Wed, 14 Jun 2023 20:52:02 +0000 (13:52 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:35:07 +0000 (11:35 -0500)
Newer Intel platforms require that inspect the contents of the GMD_ID
registers very early in the driver initialization process to determine
the IP version (and proper init sequences), of the platform.  Move the
general PCI device setup and enablement slightly earlier, before we
start trying to peek at the GMD_ID registers.

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://lore.kernel.org/r/20230614205202.3376752-5-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_pci.c

index 749826548b4a9bdb76d8668a64db343ad382df72..e130ffe3ab559198cef9ded132ec02881a5ba425 100644 (file)
@@ -627,10 +627,20 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        xe_pm_assert_unbounded_bridge(xe);
        subplatform_desc = find_subplatform(xe, desc);
 
-       err = xe_info_init(xe, desc, subplatform_desc);
+       pci_set_drvdata(pdev, xe);
+       err = pci_enable_device(pdev);
        if (err)
                goto err_drm_put;
 
+       pci_set_master(pdev);
+
+       if (pci_enable_msi(pdev) < 0)
+               drm_dbg(&xe->drm, "can't enable MSI");
+
+       err = xe_info_init(xe, desc, subplatform_desc);
+       if (err)
+               goto err_pci_disable;
+
        drm_dbg(&xe->drm, "%s %s %04x:%04x dgfx:%d gfx:%s (%d.%02d) media:%s (%d.%02d) dma_m_s:%d tc:%d",
                desc->platform_name,
                subplatform_desc ? subplatform_desc->name : "",
@@ -650,16 +660,6 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                xe_step_name(xe->info.step.display),
                xe_step_name(xe->info.step.basedie));
 
-       pci_set_drvdata(pdev, xe);
-       err = pci_enable_device(pdev);
-       if (err)
-               goto err_drm_put;
-
-       pci_set_master(pdev);
-
-       if (pci_enable_msi(pdev) < 0)
-               drm_dbg(&xe->drm, "can't enable MSI");
-
        err = xe_device_probe(xe);
        if (err)
                goto err_pci_disable;