From patchwork Thu Sep 13 13:16:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10599545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C8B214E5 for ; Thu, 13 Sep 2018 13:16:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BFDE2AD6C for ; Thu, 13 Sep 2018 13:16:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 858B92AD8C; Thu, 13 Sep 2018 13:16:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 856042AD7E for ; Thu, 13 Sep 2018 13:16:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C7336E699; Thu, 13 Sep 2018 13:16:51 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5D9BE6E699 for ; Thu, 13 Sep 2018 13:16:49 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 13756927-1500050 for multiple; Thu, 13 Sep 2018 14:16:26 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 13 Sep 2018 14:16:28 +0100 Message-Id: <20180913131629.3978-3-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131629.3978-1-chris@chris-wilson.co.uk> References: <20180913131629.3978-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/4] drm/i915: Disable displays at the user's request 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP If the user passes i915.disable_display=1 we want to disable all the displays and associated HW like the powerwells on their behalf. Instead of short circuiting the HW probe, let it run and setup all the bookkeeping for the known HW. Afterwards, instead of taking over the BIOS fb and installing the fbcon, we shutdown all the outputs and teardown the bookkeeping, leaving us with no attached outputs or crtcs, and all the HW powered down. Open: wq flushes should be required but seem to deadlock the modprobe under CI. Signed-off-by: Chris Wilson Cc: Imre Deak Cc: Ville Syrjälä --- drivers/gpu/drm/i915/i915_drv.c | 52 +++++++++++++++++------- drivers/gpu/drm/i915/intel_device_info.c | 9 ++-- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index a74de4428c79..f34a1f5b99e5 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -689,22 +689,8 @@ static int i915_load_modeset_init(struct drm_device *dev) intel_setup_overlay(dev_priv); - if (INTEL_INFO(dev_priv)->num_pipes == 0) - return 0; - - ret = intel_fbdev_init(dev_priv); - if (ret) - goto cleanup_gem; - - /* Only enable hotplug handling once the fbdev is fully set up. */ - intel_hpd_init(dev_priv); - return 0; -cleanup_gem: - if (i915_gem_suspend(dev_priv)) - DRM_ERROR("failed to idle hardware; continuing to unload!\n"); - i915_gem_fini(dev_priv); cleanup_modeset: intel_modeset_cleanup(dev); cleanup_irq: @@ -1366,6 +1352,17 @@ static void i915_driver_destroy(struct drm_i915_private *i915) pci_set_drvdata(pdev, NULL); } +static void disable_display(struct drm_i915_private *i915) +{ + drm_atomic_helper_shutdown(&i915->drm); + +#if 0 /* XXX flushes deadlock under modprobe??? */ + flush_workqueue(i915->modeset_wq); + flush_work(&i915->atomic_helper.free_work); + flush_scheduled_work(); +#endif +} + /** * i915_driver_load - setup chip and create an initial config * @pdev: PCI device @@ -1426,6 +1423,33 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) if (ret < 0) goto out_cleanup_hw; + /* + * After completing our HW probe; tear it all down again (at the + * user's request)! + * + * Along side the CRTCs and connectors, there is a medley of + * auxiliary HW which control various powerwells and interact with + * other state (such as the BIOS framebuffer occupying a portion + * of reserved memory). If the user tells us to run without any + * displays enabled, we still need to register all the display and + * auxiliary HW in order to safely disable them. + */ + if (i915_modparams.disable_display) { + DRM_INFO("Display disabled (module parameter)\n"); + disable_display(dev_priv); + mkwrite_device_info(dev_priv)->num_pipes = 0; + } + + if (INTEL_INFO(dev_priv)->num_pipes == 0) { + dev_priv->psr.sink_support = false; + drm_mode_config_cleanup(&dev_priv->drm); + driver.driver_features &= ~(DRIVER_MODESET | DRIVER_ATOMIC); + } + + /* Only enable hotplug handling once the fbdev is fully set up. */ + if (intel_fbdev_init(dev_priv) == 0) + intel_hpd_init(dev_priv); + i915_driver_register(dev_priv); intel_init_ipc(dev_priv); diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c index 0ef0c6448d53..e50ea5b2576b 100644 --- a/drivers/gpu/drm/i915/intel_device_info.c +++ b/drivers/gpu/drm/i915/intel_device_info.c @@ -776,12 +776,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info) info->num_sprites[pipe] = 1; } - if (i915_modparams.disable_display) { - DRM_INFO("Display disabled (module parameter)\n"); - info->num_pipes = 0; - } else if (info->num_pipes > 0 && - (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) && - HAS_PCH_SPLIT(dev_priv)) { + if (info->num_pipes > 0 && + (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) && + HAS_PCH_SPLIT(dev_priv)) { u32 fuse_strap = I915_READ(FUSE_STRAP); u32 sfuse_strap = I915_READ(SFUSE_STRAP); diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 84ebd8102215..9dd50c5ec558 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -668,7 +668,7 @@ int intel_fbdev_init(struct drm_i915_private *i915) struct intel_fbdev *ifbdev; int ret; - if (WARN_ON(INTEL_INFO(i915)->num_pipes == 0)) + if (INTEL_INFO(i915)->num_pipes == 0) return -ENODEV; ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);