From patchwork Tue Aug 16 11:18:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Antoine X-Patchwork-Id: 9283671 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 762FA60839 for ; Tue, 16 Aug 2016 11:18:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6672028705 for ; Tue, 16 Aug 2016 11:18:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B51228713; Tue, 16 Aug 2016 11:18:46 +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 D636128705 for ; Tue, 16 Aug 2016 11:18:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 59B086E683; Tue, 16 Aug 2016 11:18:45 +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 ESMTP id 35D276E684 for ; Tue, 16 Aug 2016 11:18:44 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 16 Aug 2016 04:18:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,529,1464678000"; d="scan'208";a="156487850" Received: from peterant-linux2.isw.intel.com ([10.102.226.41]) by fmsmga004.fm.intel.com with ESMTP; 16 Aug 2016 04:18:37 -0700 From: Peter Antoine To: intel-gfx@lists.freedesktop.org Date: Tue, 16 Aug 2016 12:18:30 +0100 Message-Id: <1471346310-17133-3-git-send-email-peter.antoine@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471346310-17133-1-git-send-email-peter.antoine@intel.com> References: <1471346310-17133-1-git-send-email-peter.antoine@intel.com> Subject: [Intel-gfx] [PATCH 2/2] drm/i915/get_params: Add HuC status to getparams 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 This patch will allow for getparams to return the status of the HuC. As the HuC has to be validated by the GuC this patch uses the validated status to show when the HuC is loaded and ready for use. You cannot use the loaded status as with the GuC as the HuC is verified after it is loaded and is not usable until it is verified. Signed-off-by: Peter Antoine --- drivers/gpu/drm/i915/i915_drv.c | 4 ++++ drivers/gpu/drm/i915/intel_huc.h | 2 +- drivers/gpu/drm/i915/intel_huc_loader.c | 21 +++++++++++++++++++++ include/uapi/drm/i915_drm.h | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index c8fc3d0..909297e 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -49,6 +49,7 @@ #include "i915_trace.h" #include "i915_vgpu.h" #include "intel_drv.h" +#include "intel_huc.h" #include "intel_guc.h" static struct drm_driver driver; @@ -355,6 +356,9 @@ static int i915_getparam(struct drm_device *dev, void *data, case I915_PARAM_MIN_EU_IN_POOL: value = INTEL_INFO(dev)->min_eu_in_pool; break; + case I915_PARAM_HAS_HUC: + value = intel_is_huc_valid(dev); + break; case I915_PARAM_HAS_GUC: value = intel_is_guc_valid(dev); break; diff --git a/drivers/gpu/drm/i915/intel_huc.h b/drivers/gpu/drm/i915/intel_huc.h index 946caa7..8c1847a 100644 --- a/drivers/gpu/drm/i915/intel_huc.h +++ b/drivers/gpu/drm/i915/intel_huc.h @@ -40,5 +40,5 @@ extern void intel_huc_init(struct drm_device *dev); extern int intel_huc_load(struct drm_device *dev); extern void intel_huc_auth(struct drm_device *dev); extern void intel_huc_fini(struct drm_device *dev); - +extern int intel_is_huc_valid(struct drm_device *dev); #endif diff --git a/drivers/gpu/drm/i915/intel_huc_loader.c b/drivers/gpu/drm/i915/intel_huc_loader.c index 87a6948..ee42d5e 100644 --- a/drivers/gpu/drm/i915/intel_huc_loader.c +++ b/drivers/gpu/drm/i915/intel_huc_loader.c @@ -273,3 +273,24 @@ void intel_huc_fini(struct drm_device *dev) huc_fw->fetch_status = UC_FIRMWARE_NONE; } + +/** + * intel_is_huc_valid() - Check to see if the HuC is fully loaded. + * @dev: drm dedvice to check. + * + * This function will return true if the guc has been loaded and + * has valid firmware. The simplest way of doing this is to check + * if the HuC has been validated, if so it must have been loaded. + */ +int intel_is_huc_valid(struct drm_device *dev) +{ + int result; + struct drm_i915_private *dev_priv = to_i915(dev); + + intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); + result = ((I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED) != 0); + intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); + + return result; +} + diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index ff8ce86..525d040 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -387,6 +387,7 @@ typedef struct drm_i915_irq_wait { #define I915_PARAM_HAS_EXEC_SOFTPIN 37 #define I915_PARAM_HAS_POOLED_EU 38 #define I915_PARAM_MIN_EU_IN_POOL 39 +#define I915_PARAM_HAS_HUC 40 #define I915_PARAM_HAS_GUC 41 typedef struct drm_i915_getparam {