From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesse Barnes Subject: Re: [PATCH 1/4] drm/i915: Allocate the PCI resource for the MCHBAR Date: Tue, 24 Aug 2010 12:25:27 -0700 Message-ID: <20100824122527.00f2cc73@virtuousgeek.org> References: <1282639383-26988-1-git-send-email-chris@chris-wilson.co.uk> <1282639383-26988-2-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from cpoproxy2-pub.bluehost.com (cpoproxy2-pub.bluehost.com [67.222.39.38]) by gabe.freedesktop.org (Postfix) with SMTP id AB5BA9E7F0 for ; Tue, 24 Aug 2010 12:25:31 -0700 (PDT) In-Reply-To: <1282639383-26988-2-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, 24 Aug 2010 09:43:00 +0100 Chris Wilson wrote: > We were failing when trying to allocate the resource for MMIO of the > MCHBAR because we forgot to specify what type of resource we wanted. > > Signed-off-by: Chris Wilson > Cc: Jesse Barnes > --- > drivers/gpu/drm/i915/i915_dma.c | 20 ++++++++++---------- > 1 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c > index 77af26d..f3433ba 100644 > --- a/drivers/gpu/drm/i915/i915_dma.c > +++ b/drivers/gpu/drm/i915/i915_dma.c > @@ -885,7 +885,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev) > int reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915; > u32 temp_lo, temp_hi = 0; > u64 mchbar_addr; > - int ret = 0; > + int ret; > > if (IS_I965G(dev)) > pci_read_config_dword(dev_priv->bridge_dev, reg + 4, &temp_hi); > @@ -895,22 +895,23 @@ intel_alloc_mchbar_resource(struct drm_device *dev) > /* If ACPI doesn't have it, assume we need to allocate it ourselves */ > #ifdef CONFIG_PNP > if (mchbar_addr && > - pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE)) { > - ret = 0; > - goto out; > - } > + pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE)) > + return 0; > #endif > > /* Get some space for it */ > - ret = pci_bus_alloc_resource(dev_priv->bridge_dev->bus, &dev_priv->mch_res, > + dev_priv->mch_res.name = "i915 MCHBAR"; > + dev_priv->mch_res.flags = IORESOURCE_MEM; > + ret = pci_bus_alloc_resource(dev_priv->bridge_dev->bus, > + &dev_priv->mch_res, > MCHBAR_SIZE, MCHBAR_SIZE, > PCIBIOS_MIN_MEM, > - 0, pcibios_align_resource, > + 0, pcibios_align_resource, > dev_priv->bridge_dev); > if (ret) { > DRM_DEBUG_DRIVER("failed bus alloc: %d\n", ret); > dev_priv->mch_res.start = 0; > - goto out; > + return ret; > } > > if (IS_I965G(dev)) > @@ -919,8 +920,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev) > > pci_write_config_dword(dev_priv->bridge_dev, reg, > lower_32_bits(dev_priv->mch_res.start)); > -out: > - return ret; > + return 0; > } > > /* Setup MCHBAR if possible, return true if we should disable it again */ Really makes me wonder how this stuff makes it through testing. Reviewed-by: Jesse Barnes -- Jesse Barnes, Intel Open Source Technology Center