Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3381795imm; Thu, 17 May 2018 07:56:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqR8rlsVhPX1rirQEAB1mJLuJw1BvQq9SfGj3aQv61geMg4z83fC+49nZbEtA9T5eCztOMr X-Received: by 2002:a63:7a19:: with SMTP id v25-v6mr4303209pgc.444.1526569018852; Thu, 17 May 2018 07:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526569018; cv=none; d=google.com; s=arc-20160816; b=nLwcp87TzKeyzteaSP4H2IajDlkomyCxxdtm1ndulQbR+xc+fwCU5f34oi9/r7QN+U BYT+c5ILu2vJPkyB+Yd1clEuE7IRV65PYmOLpEuFt4DuBz4EGoUwKFvtRVuXsxeim8ew w8MaFgyboGUMVzJmnmRuTUi+FR6+XL0oLx0g8bW5bQ2UVXMLUsGbkr4AgmghY0w4335J XVLL0jhNQBCIE5zsbqkVb9/3rSBRznd3AFPfAcL7K0y8W3BJmPJLgiQvyA4SJH4HKJUP 4tTiseqpiMZGDsYjrqmIp9BIVFLQqskMBZTWqPTWoJXPB7GovkIn9Cq82WgQMfyOUmqw b3wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=3WyCfL8t8wShFJV1xem4/pKkj2OV0soa6imn+JvKl9Y=; b=QGEyAa9sQJBEBbbzMOSbiQJpdzhT1StQzG2pyrtiGx0ZkY76de4kj9H+ZFQbW9YW3+ bWoyJtdWU/Zsg7ORglvlLrkTijaEQg2zjJ5WDuSlVoZ8di/QeRdOg6syNLlNN9DWwc+x GsnyOVUyJf6eGj51MRyZNqZMeLHOQTgHw2dAh+jU1YQ5pGC5YhrSJs9cM5uFFGNydRHI LJlwgVmHo9dOTAcCRadLZ3T39IzO5Gi/VbFTvUxNealqg5fNS4LFh6ffIg1LNUtXmedM 1b7PZbThg7rwe30+J/S386w20LNToXqaMlv6F83GQ5WMQfxweZ6vVnG/VkQBDqMJZHJS uD9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si5098091pld.188.2018.05.17.07.56.44; Thu, 17 May 2018 07:56:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752507AbeEQOzR (ORCPT + 99 others); Thu, 17 May 2018 10:55:17 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58380 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752030AbeEQOzP (ORCPT ); Thu, 17 May 2018 10:55:15 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0EF5719546D; Thu, 17 May 2018 14:55:15 +0000 (UTC) Received: from redhat.com (dhcp-10-20-1-221.bss.redhat.com [10.20.1.221]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FC602166BAD; Thu, 17 May 2018 14:55:14 +0000 (UTC) Date: Thu, 17 May 2018 10:55:13 -0400 From: Peter Jones To: Sinan Kaya Cc: linux-pci@vger.kernel.org, timur@codeaurora.org, ard.biesheuvel@linaro.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartlomiej Zolnierkiewicz , "open list:EFIFB FRAMEBUFFER DRIVER" , "open list:FRAMEBUFFER LAYER" , open list Subject: Re: [PATCH] efi/fb: Convert PCI bus address to resource if translated by the bridge Message-ID: <20180517145512.cmr3twodfyz7lzon@redhat.com> References: <1526563343-28721-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1526563343-28721-1-git-send-email-okaya@codeaurora.org> User-Agent: NeoMutt/20180323 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 17 May 2018 14:55:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 17 May 2018 14:55:15 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pjones@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 17, 2018 at 09:22:23AM -0400, Sinan Kaya wrote: > A host bridge is allowed to remap BAR addresses using _TRA attribute in > _CRS windows. > > pci_bus 0000:00: root bus resource [mem 0x80100100000-0x8011fffffff window] (bus address [0x00100000-0x1fffffff]) > pci 0000:02:00.0: reg 0x10: [mem 0x8011e000000-0x8011effffff] > > When a VGA device is behind such a host bridge and the resource is > translated efifb driver is trying to do ioremap against bus address > rather than the resource address and is failing to probe. > > efifb driver is having difficulty locating the base address from BAR > address when > > efifb: probing for efifb > efifb: cannot reserve video memory at 0x1e000000 > efifb: framebuffer at 0x1e000000, using 1920k, total 1875k > efifb: mode is 800x600x32, linelength=3200, pages=1 > efifb: scrolling: redraw > efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0 > > Use the host bridge offset information to convert bus address to > resource address in the fixup. > > Signed-off-by: Sinan Kaya Looks reasonable to me - Ard, do you want to take this up through the EFI tree? Signed-off-by: Peter Jones > --- > drivers/video/fbdev/efifb.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c > index 46a4484..ea68d5c 100644 > --- a/drivers/video/fbdev/efifb.c > +++ b/drivers/video/fbdev/efifb.c > @@ -428,6 +428,8 @@ static void efifb_fixup_resources(struct pci_dev *dev) > { > u64 base = screen_info.lfb_base; > u64 size = screen_info.lfb_size; > + struct pci_bus_region region; > + struct resource res; > int i; > > if (efifb_pci_dev || screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) > @@ -439,6 +441,14 @@ static void efifb_fixup_resources(struct pci_dev *dev) > if (!base) > return; > > + region.start = base; > + region.end = base + size - 1; > + res.start = 0; > + res.flags = IORESOURCE_MEM; > + pcibios_bus_to_resource(dev->bus, &res, ®ion); > + if (res.start) > + base = res.start; > + > for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { > struct resource *res = &dev->resource[i]; > > -- > 2.7.4 > -- Peter