From patchwork Thu Sep 19 14:03:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 11152527 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97EF376 for ; Thu, 19 Sep 2019 14:05:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 802EA20882 for ; Thu, 19 Sep 2019 14:05:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 802EA20882 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CBE36F807; Thu, 19 Sep 2019 14:05:12 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 70A1E6F807 for ; Thu, 19 Sep 2019 14:05:10 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2019 07:05:08 -0700 X-IronPort-AV: E=Sophos;i="5.64,523,1559545200"; d="scan'208";a="189614308" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2019 07:05:06 -0700 From: Jani Nikula To: intel-gfx@lists.freedesktop.org Date: Thu, 19 Sep 2019 17:03:57 +0300 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH 10/13] drm/i915: split i915_driver_modeset_probe() to pre/post irq install X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Pair the irq install and uninstall in the same layer. There are no functional changes in the happy day scenario. The cleanup paths are currently a mess though. Note that modeset probe pre-irq + post-irq install are matched by modeset driver remove pre-irq + post-irq uninstall, together, but not independently. They are not symmetric pairs. Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/i915_drv.c | 41 +++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 7a7a1b7d5da2..30b0548a5648 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -328,6 +328,7 @@ static const struct vga_switcheroo_client_ops i915_switcheroo_ops = { .can_switch = i915_switcheroo_can_switch, }; +/* part #1: call before irq install */ static int i915_driver_modeset_probe(struct drm_i915_private *i915) { struct pci_dev *pdev = i915->drm.pdev; @@ -369,15 +370,27 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915) intel_csr_ucode_init(i915); - ret = intel_irq_install(i915); - if (ret) - goto cleanup_csr; + return 0; + +cleanup_vga_client: + vga_client_register(pdev, NULL, NULL, NULL); +out: + return ret; +} + +/* part #2: call after irq install */ +static int i915_driver_modeset_probe_irq(struct drm_i915_private *i915) +{ + int ret; + + if (i915_inject_probe_failure(i915)) + return -ENODEV; /* Important: The output setup functions called by modeset_init need * working irqs for e.g. gmbus and dp aux transfers. */ ret = intel_modeset_init(i915); if (ret) - goto cleanup_irq; + goto out; ret = i915_gem_init(i915); if (ret) @@ -406,14 +419,6 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915) cleanup_modeset: intel_modeset_driver_remove_irq(i915); intel_modeset_driver_remove(i915); -cleanup_irq: - intel_irq_uninstall(i915); -cleanup_csr: - intel_csr_ucode_fini(i915); - intel_power_domains_driver_remove(i915); - vga_switcheroo_unregister_client(pdev); -cleanup_vga_client: - vga_client_register(pdev, NULL, NULL, NULL); out: return ret; } @@ -1577,6 +1582,14 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (ret < 0) goto out_cleanup_hw; + ret = intel_irq_install(dev_priv); + if (ret) + goto out_cleanup_modeset; + + ret = i915_driver_modeset_probe_irq(dev_priv); + if (ret < 0) + goto out_cleanup_irq; + i915_driver_register(dev_priv); enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); @@ -1585,6 +1598,10 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return 0; +out_cleanup_irq: + intel_irq_uninstall(dev_priv); +out_cleanup_modeset: + /* FIXME */ out_cleanup_hw: i915_driver_hw_remove(dev_priv); i915_ggtt_driver_release(dev_priv);