From patchwork Fri Jun 8 13:42:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 10454525 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 7AD5E60467 for ; Fri, 8 Jun 2018 13:42:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E97A2944D for ; Fri, 8 Jun 2018 13:42:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72F082945C; Fri, 8 Jun 2018 13:42:35 +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 279EA2944D for ; Fri, 8 Jun 2018 13:42:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6470C6E0B0; Fri, 8 Jun 2018 13:42:29 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 450C56E0B0 for ; Fri, 8 Jun 2018 13:42:28 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jun 2018 06:42:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,490,1520924400"; d="scan'208";a="206412350" Received: from rosetta.fi.intel.com ([10.237.72.186]) by orsmga004.jf.intel.com with ESMTP; 08 Jun 2018 06:42:25 -0700 Received: by rosetta.fi.intel.com (Postfix, from userid 1000) id 5DE6B8407CC; Fri, 8 Jun 2018 16:42:08 +0300 (EEST) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Fri, 8 Jun 2018 16:42:05 +0300 Message-Id: <20180608134205.6452-5-mika.kuoppala@linux.intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180608134205.6452-1-mika.kuoppala@linux.intel.com> References: <20180608134205.6452-1-mika.kuoppala@linux.intel.com> Subject: [Intel-gfx] [PATCH 5/5] drm/i915: Warn on obsolete revision checks 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP If we are doing revision checks against a preproduction range, when there is already a product, it is a sign that there is code to be removed. Signed-off-by: Mika Kuoppala --- drivers/gpu/drm/i915/intel_chipset.h | 30 +++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_chipset.h b/drivers/gpu/drm/i915/intel_chipset.h index 946c889c0118..bc9ff02dc8df 100644 --- a/drivers/gpu/drm/i915/intel_chipset.h +++ b/drivers/gpu/drm/i915/intel_chipset.h @@ -131,6 +131,12 @@ #define IS_PREPRODUCTION_HW(dev_priv) (INTEL_REVID(dev_priv) < FIRST_PRODUCT_REVID(INTEL_INFO(dev_priv))) #define IS_PLATFORM_SUPPORT_ALPHA(intel_info) (FIRST_PRODUCT_REVID(intel_info) == PRODUCT_REVID_UNKNOWN) +#define BUILD_BUG_ON_REVID_LT(revid, production_revid) ({ \ + BUILD_BUG_ON((production_revid) != PRODUCT_REVID_UNKNOWN && \ + (revid) < (production_revid)); \ + 1; \ + }) + #define SKL_REVID_A0 0x0 #define SKL_REVID_B0 0x1 #define SKL_REVID_C0 0x2 @@ -141,7 +147,9 @@ #define SKL_REVID_PRODUCT SKL_REVID_G0 #define SKL_REVID_H0 0x7 -#define IS_SKL_REVID(p, since, until) (IS_SKYLAKE(p) && IS_REVID(p, since, until)) +#define IS_SKL_REVID(p, since, until) \ + (BUILD_BUG_ON_REVID_LT(until, SKL_REVID_PRODUCT) && \ + IS_SKYLAKE(p) && IS_REVID(p, since, until)) #define BXT_REVID_A0 0x0 #define BXT_REVID_A1 0x1 @@ -151,7 +159,8 @@ #define BXT_REVID_PRODUCT BXT_REVID_C0 #define IS_BXT_REVID(dev_priv, since, until) \ - (IS_BROXTON(dev_priv) && IS_REVID(dev_priv, since, until)) + (BUILD_BUG_ON_REVID_LT(until, BXT_REVID_PRODUCT) && \ + IS_BROXTON(dev_priv) && IS_REVID(dev_priv, since, until)) #define KBL_REVID_A0 0x0 #define KBL_REVID_B0 0x1 @@ -161,29 +170,36 @@ #define KBL_REVID_E0 0x4 #define IS_KBL_REVID(dev_priv, since, until) \ - (IS_KABYLAKE(dev_priv) && IS_REVID(dev_priv, since, until)) + (BUILD_BUG_ON_REVID_LT(until, KBL_REVID_PRODUCT) && \ + IS_KABYLAKE(dev_priv) && IS_REVID(dev_priv, since, until)) #define GLK_REVID_A0 0x0 #define GLK_REVID_A1 0x1 +#define GLK_REVID_PRODUCT PRODUCT_REVID_UNKNOWN -#define IS_GLK_REVID(dev_priv, since, until) \ - (IS_GEMINILAKE(dev_priv) && IS_REVID(dev_priv, since, until)) +#define IS_GLK_REVID(dev_priv, since, until) \ + (BUILD_BUG_ON_REVID_LT(until, GLK_REVID_PRODUCT) && \ + IS_GEMINILAKE(dev_priv) && IS_REVID(dev_priv, since, until)) #define CNL_REVID_A0 0x0 #define CNL_REVID_B0 0x1 #define CNL_REVID_C0 0x2 +#define CNL_REVID_PRODUCT PRODUCT_REVID_UNKNOWN #define IS_CNL_REVID(p, since, until) \ - (IS_CANNONLAKE(p) && IS_REVID(p, since, until)) + (BUILD_BUG_ON_REVID_LT(until, CNL_REVID_PRODUCT) && \ + IS_CANNONLAKE(p) && IS_REVID(p, since, until)) #define ICL_REVID_A0 0x0 #define ICL_REVID_A2 0x1 #define ICL_REVID_B0 0x3 #define ICL_REVID_B2 0x4 #define ICL_REVID_C0 0x5 +#define ICL_REVID_PRODUCT PRODUCT_REVID_UNKNOWN #define IS_ICL_REVID(p, since, until) \ - (IS_ICELAKE(p) && IS_REVID(p, since, until)) + (BUILD_BUG_ON_REVID_LT(until, ICL_REVID_PRODUCT) && \ + IS_ICELAKE(p) && IS_REVID(p, since, until)) /* * The genX designation typically refers to the render engine, so render