From patchwork Wed May 5 03:37:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 12239103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BFE6C433ED for ; Wed, 5 May 2021 06:08:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 86E376117A for ; Wed, 5 May 2021 06:08:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86E376117A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B11A76E425; Wed, 5 May 2021 06:08:06 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 721B46E40A; Wed, 5 May 2021 03:37:48 +0000 (UTC) IronPort-SDR: B3oO7FJXXY8eWCHFEOXI9D2RqiTJjU7dee0TLFijXFM15rHjrxEGpDvbIv0gJvyEj920r+7JUQ ulMGs4t62zaQ== X-IronPort-AV: E=McAfee;i="6200,9189,9974"; a="196080427" X-IronPort-AV: E=Sophos;i="5.82,273,1613462400"; d="scan'208";a="196080427" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2021 20:37:47 -0700 IronPort-SDR: RRkdKy+ckiIauACqzCOPaYhrEMtArGKVheHBa3UotahxT8ckoBUWNlbT4m5TO9jATlnBeFE/TR TyDG4FupUgjg== X-IronPort-AV: E=Sophos;i="5.82,273,1613462400"; d="scan'208";a="433601761" Received: from tassilo.jf.intel.com ([10.54.74.11]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2021 20:37:47 -0700 From: Andi Kleen To: jani.nikula@linux.intel.com Subject: [PATCH] i915: Increase *_latency array size Date: Tue, 4 May 2021 20:37:37 -0700 Message-Id: <20210505033737.1282652-1-ak@linux.intel.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 05 May 2021 06:08:04 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Andi Kleen , rodrigo.vivi@intel.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Andi Kleen Newer gcc prints the following warning: drivers/gpu/drm/i915/intel_pm.c:3057:9: warning: ‘intel_print_wm_latency’ reading 16 bytes from a region of size 10 [-Wstringop-overread] and some other related warnings in similar functions. gcc has a point here. Some of the latency arrays only have 5 members, but print_wm_latency may read up to max_level returned by ilk_wm_max_level, which can be upto 7 for the >= GEN9 case. So it will read some fields beyond the array. Increase all the latency fields to 8 members, which is enough for SKL. I don't know if they are correctly initialized upto 8, but dev_priv should start out as zero, so presumably they will be zero. Signed-off-by: Andi Kleen --- drivers/gpu/drm/i915/i915_drv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index cb62ddba2035..c80add5f6d33 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1095,11 +1095,11 @@ struct drm_i915_private { * in 0.5us units for WM1+. */ /* primary */ - u16 pri_latency[5]; + u16 pri_latency[8]; /* sprite */ - u16 spr_latency[5]; + u16 spr_latency[8]; /* cursor */ - u16 cur_latency[5]; + u16 cur_latency[8]; /* * Raw watermark memory latency values * for SKL for all 8 levels