From patchwork Thu Jun 7 17:41:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 10453301 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 D7BC460467 for ; Thu, 7 Jun 2018 17:41:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9067298A8 for ; Thu, 7 Jun 2018 17:41:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE1D8298B0; Thu, 7 Jun 2018 17:41:49 +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 6F8B7298A8 for ; Thu, 7 Jun 2018 17:41:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D96416F365; Thu, 7 Jun 2018 17:41:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id C44806F35B for ; Thu, 7 Jun 2018 17:41:39 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2018 10:41:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,487,1520924400"; d="scan'208";a="47251383" Received: from rosetta.fi.intel.com ([10.237.72.186]) by orsmga007.jf.intel.com with ESMTP; 07 Jun 2018 10:41:38 -0700 Received: by rosetta.fi.intel.com (Postfix, from userid 1000) id 66E2E8407CD; Thu, 7 Jun 2018 20:41:20 +0300 (EEST) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Thu, 7 Jun 2018 20:41:17 +0300 Message-Id: <20180607174117.28402-6-mika.kuoppala@linux.intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607174117.28402-1-mika.kuoppala@linux.intel.com> References: <20180607174117.28402-1-mika.kuoppala@linux.intel.com> Subject: [Intel-gfx] [PATCH 6/6] 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 d6cd7ba7d669..3f38b052863e 100644 --- a/drivers/gpu/drm/i915/intel_chipset.h +++ b/drivers/gpu/drm/i915/intel_chipset.h @@ -130,6 +130,12 @@ #define IS_PREPRODUCTION_HW(dev_priv) (INTEL_REVID(dev_priv) < FIRST_PRODUCT_REVID(INTEL_INFO(dev_priv))) #define IS_ALPHA_SUPPORT(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 @@ -140,7 +146,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 @@ -150,7 +158,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 @@ -160,32 +169,39 @@ #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_B0 0x3 +#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_D0 0x4 #define CNL_REVID_G0 0x5 +#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