From patchwork Thu Jan 14 12:02:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, Shobhit" X-Patchwork-Id: 8031171 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1EE41BEEE5 for ; Thu, 14 Jan 2016 12:03:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E44D2042C for ; Thu, 14 Jan 2016 12:03:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 54CCA2041E for ; Thu, 14 Jan 2016 12:03:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C4DF68A66D; Thu, 14 Jan 2016 04:03:14 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 094768A66D for ; Thu, 14 Jan 2016 04:03:12 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 14 Jan 2016 04:03:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,294,1449561600"; d="scan'208";a="726853705" Received: from skumar40-mobl.iind.intel.com ([10.223.176.41]) by orsmga003.jf.intel.com with ESMTP; 14 Jan 2016 04:03:08 -0800 From: Shobhit Kumar To: intel-gfx@lists.freedesktop.org Date: Thu, 14 Jan 2016 17:32:47 +0530 Message-Id: <1452772968-24772-7-git-send-email-shobhit.kumar@intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1452772968-24772-1-git-send-email-shobhit.kumar@intel.com> References: <1452772968-24772-1-git-send-email-shobhit.kumar@intel.com> Subject: [Intel-gfx] [PATCH 6/7] drm/i915: Add support to parse DMI table and get platform memory info 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is needed for WM computation workaround for arbitrated display bandwidth. Signed-off-by: Shobhit Kumar --- drivers/gpu/drm/i915/i915_dma.c | 19 +++++++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index a0f5659..03c3131 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -49,6 +49,7 @@ #include #include #include +#include static int i915_getparam(struct drm_device *dev, void *data, @@ -855,6 +856,21 @@ static void intel_init_dpio(struct drm_i915_private *dev_priv) } } +static void dmi_decode_memory_info(const struct dmi_header *hdr, void *priv) +{ + struct drm_i915_private *dev_priv = (struct drm_i915_private *) priv; + const u8 *data = (const u8 *) hdr; + + if (hdr->type == 17 && hdr->length > 0x17) { + + /* Found a memory channel */ + dev_priv->dmi.mem_channel++; + + /* Get the speed */ + dev_priv->dmi.mem_speed = (uint16_t) (*((uint16_t *)(data + 0x15))); + } +} + /** * i915_driver_load - setup chip and create an initial config * @dev: DRM device @@ -882,6 +898,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) dev->dev_private = dev_priv; dev_priv->dev = dev; + /* walk the dmi device table for getting platform memory information */ + dmi_walk(dmi_decode_memory_info, (void *) dev_priv); + /* Setup the write-once "constant" device info */ device_info = (struct intel_device_info *)&dev_priv->info; memcpy(device_info, info, sizeof(dev_priv->info)); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 104bd18..f588993 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1962,6 +1962,12 @@ struct drm_i915_private { * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch * will be rejected. Instead look for a better place. */ + + /* DMI data for memory bandwidth calculation */ + struct { + uint16_t mem_channel; + uint16_t mem_speed; + } dmi; }; static inline struct drm_i915_private *to_i915(const struct drm_device *dev)