From patchwork Sat Mar 12 12:26:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 8576601 Return-Path: X-Original-To: patchwork-dri-devel@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 CD087C0553 for ; Mon, 14 Mar 2016 05:57:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0D8B2045E for ; Mon, 14 Mar 2016 05:57:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 142952044B for ; Mon, 14 Mar 2016 05:57:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AFECC6E5D3; Mon, 14 Mar 2016 05:57:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id D16956E30B; Sat, 12 Mar 2016 12:26:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 694EB20377; Sat, 12 Mar 2016 12:26:28 +0000 (UTC) Received: from localhost (unknown [69.71.1.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6E999201FA; Sat, 12 Mar 2016 12:26:27 +0000 (UTC) Date: Sat, 12 Mar 2016 06:26:22 -0600 From: Bjorn Helgaas To: Bjorn Helgaas Subject: Re: [PATCH v1 00/12] PCI: Rework shadow ROM handling Message-ID: <20160312122622.GC27552@localhost> References: <20160303164533.3025.82439.stgit@bhelgaas-glaptop2.roam.corp.google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160303164533.3025.82439.stgit@bhelgaas-glaptop2.roam.corp.google.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 X-Mailman-Approved-At: Mon, 14 Mar 2016 05:57:18 +0000 Cc: Fenghua Yu , Tony Luck , Matthew Garrett , linux-pci@vger.kernel.org, Intel Graphics Development , linux-kernel@vger.kernel.org, DRI , Andy Lutomirski , Bruno =?iso-8859-1?Q?Pr=E9mont?= , Ralf Baechle , Linus Torvalds X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Mar 03, 2016 at 10:53:50AM -0600, Bjorn Helgaas wrote: > The purpose of this series is to: > ... > - Move arch-specific shadow ROM location knowledge, e.g., > 0xC0000-0xDFFFF, from PCI core to arch code. > ... > Bjorn Helgaas (12): > PCI: Mark shadow copy of VGA ROM as IORESOURCE_PCI_FIXED > PCI: Don't assign or reassign immutable resources > PCI: Don't enable/disable ROM BAR if we're using a RAM shadow copy > PCI: Set ROM shadow location in arch code, not in PCI core I propose to add the patch below at this point in the series. > PCI: Clean up pci_map_rom() whitespace > ia64/PCI: Use temporary struct resource * to avoid repetition > ia64/PCI: Use ioremap() instead of open-coded equivalent > ia64/PCI: Keep CPU physical (not virtual) addresses in shadow ROM resource > MIPS: Loongson 3: Use temporary struct resource * to avoid repetition > MIPS: Loongson 3: Keep CPU physical (not virtual) addresses in shadow ROM resource > PCI: Remove unused IORESOURCE_ROM_COPY and IORESOURCE_ROM_BIOS_COPY > PCI: Simplify sysfs ROM cleanup commit ac0c302a919ba7b68dbf274babdc08c83df6f532 Author: Bjorn Helgaas Date: Sat Mar 12 05:48:08 2016 -0600 PCI: Remove arch-specific IORESOURCE_ROM_SHADOW size from sysfs When pci_create_sysfs_dev_files() created the "rom" sysfs file, it set the sysfs file size to the actual size of a ROM BAR, or if there was no ROM BAR but the platform provided a shadow copy in RAM, to 0x20000. 0x20000 is an arch-specific length that should not be baked into the PCI core. Every place that sets IORESOURCE_ROM_SHADOW also sets the size of the PCI_ROM_RESOURCE, so use the resource length always. Signed-off-by: Bjorn Helgaas diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 95d9e7b..51d4dad 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1356,7 +1356,7 @@ error: int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev) { int retval; - int rom_size = 0; + int rom_size; struct bin_attribute *attr; if (!sysfs_initialized) @@ -1373,12 +1373,8 @@ int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev) if (retval) goto err_config_file; - if (pci_resource_len(pdev, PCI_ROM_RESOURCE)) - rom_size = pci_resource_len(pdev, PCI_ROM_RESOURCE); - else if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW) - rom_size = 0x20000; - /* If the device has a ROM, try to expose it in sysfs. */ + rom_size = pci_resource_len(pdev, PCI_ROM_RESOURCE); if (rom_size) { attr = kzalloc(sizeof(*attr), GFP_ATOMIC); if (!attr) {