From patchwork Thu Jan 9 05:30:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: akash.goel@intel.com X-Patchwork-Id: 3457391 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 77DFAC02DC for ; Thu, 9 Jan 2014 05:28:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F69E20165 for ; Thu, 9 Jan 2014 05:28:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5576B2015F for ; Thu, 9 Jan 2014 05:28:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B236FBCD1; Wed, 8 Jan 2014 21:28:46 -0800 (PST) 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 EED8BFBC0A for ; Wed, 8 Jan 2014 21:28:40 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 08 Jan 2014 21:24:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,628,1384329600"; d="scan'208";a="436144619" Received: from akashgoe-desktop.iind.intel.com ([10.223.82.34]) by orsmga001.jf.intel.com with ESMTP; 08 Jan 2014 21:28:39 -0800 From: akash.goel@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 9 Jan 2014 11:00:28 +0530 Message-Id: <1389245428-10880-1-git-send-email-akash.goel@intel.com> X-Mailer: git-send-email 1.8.5.2 Cc: Akash Goel Subject: [Intel-gfx] [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org 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 From: Akash Goel There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because as somehow the start/base location of the Parent region of Stolen area which is PCI Bus 0000:00 is not coinciding with the start of Stolen area and is conflicting with it. For ex. from the device memory map info provided by '/proc/iomem', we have seen that somehow a region of PCI Bus 0000:00 is being shown to start from 0x7b000001, i.e. (7b000001-ffffffff : PCI Bus 0000:00) & not from 0x7b000000. And the stolen base is coming as 0x7b000000, thus there is a conflict & stolen area remains unused by driver. So to circumvent this issue we adjust the base of stolen area by 1 byte when registering it with the kernel. Otherwise if we don't resolve this conflict or don't remove the conflict error check from the driver, the stolen area will remain disabled. Signed-off-by: Akash Goel --- drivers/gpu/drm/i915/i915_gem_stolen.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 1a24e84..29b3693 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -82,9 +82,30 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size, "Graphics Stolen Memory"); if (r == NULL) { - DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n", - base, base + (uint32_t)dev_priv->gtt.stolen_size); - base = 0; + /* One more attempt but this time requesting region from + * base + 1, as we have seen that this resolves the region + * conflict with the PCI Bus. + * This is because as somehow the start/base location of + * the Parent region of Stolen area which is PCI Bus 0000:00 + * is not coinciding with the start of Stolen area and is + * conflicting with it. For ex. from the device memory map + * info provided by '/proc/iomem', we have seen that somehow + * a region of PCI Bus 0000:00 is being shown to start from + * 0x7b000001, i.e. (7b000001-ffffffff : PCI Bus 0000:00). + * And the stolen base is coming as 0x7b000000, thus there is a + * conflict and stolen memory remains unused by the driver. + * So to circumvent this issue we adjust the base of stolen + * area by 1 when registering it with the kernel. + */ + r = devm_request_mem_region(dev->dev, base + 1, + dev_priv->gtt.stolen_size - 1, + "Graphics Stolen Memory"); + if (r == NULL) { + DRM_ERROR("conflict detected with stolen region:"\ + "[0x%08x - 0x%08x]\n", + base, base + (uint32_t)dev_priv->gtt.stolen_size); + base = 0; + } } return base;