From patchwork Thu Dec 15 15:47:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arkadiusz Hiler X-Patchwork-Id: 9476465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB53D60571 for ; Thu, 15 Dec 2016 15:47:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCA2428575 for ; Thu, 15 Dec 2016 15:47:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C18E828749; Thu, 15 Dec 2016 15:47:50 +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=-4.2 required=2.0 tests=BAYES_00, 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 746BF28575 for ; Thu, 15 Dec 2016 15:47:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F1266E9EA; Thu, 15 Dec 2016 15:47:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id A97586E9EA for ; Thu, 15 Dec 2016 15:47:44 +0000 (UTC) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP; 15 Dec 2016 07:47:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,352,1477983600"; d="scan'208";a="40257108" Received: from ahiler-desk.igk.intel.com ([172.28.171.151]) by orsmga004.jf.intel.com with ESMTP; 15 Dec 2016 07:47:43 -0800 From: Arkadiusz Hiler To: intel-gfx@lists.freedesktop.org Date: Thu, 15 Dec 2016 16:47:07 +0100 Message-Id: <20161215154708.31521-5-arkadiusz.hiler@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161215154708.31521-1-arkadiusz.hiler@intel.com> References: <20161215154708.31521-1-arkadiusz.hiler@intel.com> Organization: Intel Technology Poland sp. z o.o. - KRS 101882 - ul. Slowackiego 173, 80-298 Gdansk Subject: [Intel-gfx] [PATCH 4/5] drm/i915/guc: Extract param logic form guc_init X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Let intel_guc_init() focus on determining and fetching the correct firmware. This patch introduces intel_sanitize_uc_params() that is called from intel_uc_init(). Then, if we have GuC, we can call intel_guc_init() conditionally and we do not have to do internal checks. It can be easily extended to support HuC case as well. Cc: Anusha Srivatsa Cc: Jeff McGee Cc: Michal Winiarski Signed-off-by: Arkadiusz Hiler --- drivers/gpu/drm/i915/intel_guc_loader.c | 19 +------------------ drivers/gpu/drm/i915/intel_uc.c | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c index b76b556..0bb5fd1 100644 --- a/drivers/gpu/drm/i915/intel_guc_loader.c +++ b/drivers/gpu/drm/i915/intel_guc_loader.c @@ -617,7 +617,7 @@ static void guc_fw_fetch(struct drm_i915_private *dev_priv, } /** - * intel_guc_init() - define parameters and fetch firmware + * intel_guc_init() - determine and fetch firmware * @dev_priv: i915 device private * * Called early during driver load, but after GEM is initialised. @@ -630,17 +630,6 @@ void intel_guc_init(struct drm_i915_private *dev_priv) struct intel_guc_fw *guc_fw = &dev_priv->guc.guc_fw; const char *fw_path; - if (!HAS_GUC(dev_priv)) { - i915.enable_guc_loading = 0; - i915.enable_guc_submission = 0; - } else { - /* A negative value means "use platform default" */ - if (i915.enable_guc_loading < 0) - i915.enable_guc_loading = HAS_GUC_UCODE(dev_priv); - if (i915.enable_guc_submission < 0) - i915.enable_guc_submission = HAS_GUC_SCHED(dev_priv); - } - if (!HAS_GUC_UCODE(dev_priv)) { fw_path = NULL; } else if (IS_SKYLAKE(dev_priv)) { @@ -663,13 +652,7 @@ void intel_guc_init(struct drm_i915_private *dev_priv) guc_fw->guc_fw_fetch_status = GUC_FIRMWARE_NONE; guc_fw->guc_fw_load_status = GUC_FIRMWARE_NONE; - /* can't enable guc submission without guc */ - if (!i915.enable_guc_loading) - i915.enable_guc_submission = 0; - /* Early (and silent) return if GuC loading is disabled */ - if (!i915.enable_guc_loading) - return; if (fw_path == NULL) return; if (*fw_path == '\0') diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c index 4e184edb..e72f784 100644 --- a/drivers/gpu/drm/i915/intel_uc.c +++ b/drivers/gpu/drm/i915/intel_uc.c @@ -25,6 +25,24 @@ #include "i915_drv.h" #include "intel_uc.h" +static void intel_sanitize_uc_params(struct drm_i915_private *dev_priv) +{ + if (!HAS_GUC(dev_priv)) { + i915.enable_guc_loading = 0; + i915.enable_guc_submission = 0; + } else { + /* A negative value means "use platform default" */ + if (i915.enable_guc_loading < 0) + i915.enable_guc_loading = HAS_GUC_UCODE(dev_priv); + if (i915.enable_guc_submission < 0) + i915.enable_guc_submission = HAS_GUC_SCHED(dev_priv); + } + + /* can't enable guc submission without guc */ + if (!i915.enable_guc_loading) + i915.enable_guc_submission = 0; +} + void intel_uc_init_early(struct drm_i915_private *dev_priv) { mutex_init(&dev_priv->guc.send_mutex); @@ -32,7 +50,10 @@ void intel_uc_init_early(struct drm_i915_private *dev_priv) void intel_uc_init(struct drm_i915_private *dev_priv) { - intel_guc_init(dev_priv); + intel_sanitize_uc_params(dev_priv); + + if (i915.enable_guc_loading) + intel_guc_init(dev_priv); } int intel_uc_load(struct drm_i915_private *dev_priv)