From patchwork Sat Dec 21 01:19:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 3392781 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 C0D0FC0D4A for ; Sat, 21 Dec 2013 01:20:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27D112070B for ; Sat, 21 Dec 2013 01:20:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 802AC20704 for ; Sat, 21 Dec 2013 01:20:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751989Ab3LUBTj (ORCPT ); Fri, 20 Dec 2013 20:19:39 -0500 Received: from mail-ig0-f171.google.com ([209.85.213.171]:51265 "EHLO mail-ig0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751832Ab3LUBTj (ORCPT ); Fri, 20 Dec 2013 20:19:39 -0500 Received: by mail-ig0-f171.google.com with SMTP id c10so16591510igq.4 for ; Fri, 20 Dec 2013 17:19:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=rIMJf6ZXAgAiJswB7JWSMlQ7bz1iKRwGnwg1akrGHHY=; b=fKhkT/yOg37DG9bzInb2pl/usKcQateicVSZIDBPpdCn24V3xvIlPMxLF4tzEy34oE JnMyb05ErT73gm4kWAEiyWFw4HCuVA90LMmcTdaxo64iGKUrE+lNqsiFWhlM7n0b4jP2 ujTnjPlHPSEdZyMkTRmHkFkUUhZsBMckLEa6px0wpRp+uAUEbYHcXC4INHPpc2zfIiX+ 1dSEyQH7+JiFYaTHRdBSUZLwIHK8fHdRjBAu6MRlpHfnYDxVHsEMSMzteGEOBa5zHh1S 5Pn8hnkjGVnBNjglT3vcQ+CSqj4kntMtWGxYm3iHCCeGmNyfhwNvGz2yNoHIpt4lV7V3 dyJQ== MIME-Version: 1.0 X-Received: by 10.50.28.111 with SMTP id a15mr10336216igh.3.1387588778660; Fri, 20 Dec 2013 17:19:38 -0800 (PST) Received: by 10.64.235.70 with HTTP; Fri, 20 Dec 2013 17:19:38 -0800 (PST) In-Reply-To: References: <1385429290-25397-1-git-send-email-yinghai@kernel.org> <1385429290-25397-11-git-send-email-yinghai@kernel.org> Date: Fri, 20 Dec 2013 17:19:38 -0800 X-Google-Sender-Auth: IHNhrsUklJ4kwpGpITyAGs68ER4 Message-ID: Subject: Re: [PATCH v2 10/10] intel-gtt: Read 64bit for gmar_bus_addr From: Yinghai Lu To: Bjorn Helgaas Cc: "Rafael J. Wysocki" , Gu Zheng , Guo Chao , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , David Airlie Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,T_TVD_MIME_EPI, 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 On Fri, Dec 20, 2013 at 4:27 PM, Bjorn Helgaas wrote: > Why are we reading these BARs directly anyway? These look like > standard PCI BARs (I810_GMADDR == 0x10 and I915_GMADDR == 0x18), so > the PCI core should already be reading them correctly, shouldn't it? > Can't we just use pcibios_resource_to_bus(pci_resource_start())? > > It looks like i810_setup(), i830_setup(), and i9xx_setup() have the > same problem and should also be using pci_resource_start() or > something similar. Agreed. should be sth like: diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index b8e2014..0250017 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c @@ -608,9 +608,9 @@ static bool intel_gtt_can_wc(void) static int intel_gtt_init(void) { - u32 gma_addr; + struct pci_bus_region r; u32 gtt_map_size; - int ret; + int ret, idx; ret = intel_private.driver->setup(); if (ret != 0) @@ -660,13 +660,14 @@ static int intel_gtt_init(void) } if (INTEL_GTT_GEN <= 2) - pci_read_config_dword(intel_private.pcidev, I810_GMADDR, - &gma_addr); + idx = 0; /* I810_GMADDR */ else - pci_read_config_dword(intel_private.pcidev, I915_GMADDR, - &gma_addr); + idx = 2; /* I915_GMADDR */ + + pcibios_resource_to_bus(intel_private.pcidev->bus, &r, + &intel_private.pcidev->resource[idx]); - intel_private.gma_bus_addr = (gma_addr & PCI_BASE_ADDRESS_MEM_MASK); + intel_private.gma_bus_addr = r.start; return 0; }