From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f174.google.com ([209.85.213.174]:56249 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752606AbaA3AIe (ORCPT ); Wed, 29 Jan 2014 19:08:34 -0500 Received: by mail-ig0-f174.google.com with SMTP id hl1so16368779igb.1 for ; Wed, 29 Jan 2014 16:08:34 -0800 (PST) Date: Wed, 29 Jan 2014 17:08:31 -0700 From: Bjorn Helgaas To: Sander Eikelenboom Cc: eiichiro.oiwa.nm@hitachi.com, Dave Airlie , Greg Kroah-Hartman , Konrad Rzeszutek Wilk , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" Subject: Re: In "pci_fixup_video" check if this is or should be the primary video devi Message-ID: <20140130000831.GJ16825@google.com> References: <1389499841-6097-1-git-send-email-linux@eikelenboom.it> <6310129377.20140114162641@eikelenboom.it> <126550032.20140115203605@eikelenboom.it> <1524137311.20140115232528@eikelenboom.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1524137311.20140115232528@eikelenboom.it> Sender: linux-pci-owner@vger.kernel.org List-ID: On Wed, Jan 15, 2014 at 11:25:28PM +0100, Sander Eikelenboom wrote: > Date: Sun, 12 Jan 2014 04:49:44 +0100 > Subject: [PATCH] In "pci_fixup_video" check if this is or should be the > primary video device to prevent setting the > IORESOURCE_ROM_SHADOW flag on a secondary VGA card > To: Dave Airlie , > Eiichiro Oiwa , > Greg Kroah-Hartman > Cc: Konrad Rzeszutek Wilk , > linux-kernel@vger.kernel.org > > Setting the IORESOURCE_ROM_SHADOW flag on a secondary VGA card prevents if from > reading it's own rom. It will get the content of the shadowrom at C000 instead, > which is of the primary VGA card and the driver of the secondary card will bail > out. > > Fix this by checking if this is or should be the primary video device before > applying the fix and let the comment reflect this. > > Signed-off-by: Sander Eikelenboom > --- > arch/x86/pci/fixup.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c > index b046e07..525e49a 100644 > --- a/arch/x86/pci/fixup.c > +++ b/arch/x86/pci/fixup.c > @@ -314,9 +314,9 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_r > * IORESOURCE_ROM_SHADOW is used to associate the boot video > * card with this copy. On laptops this copy has to be used since > * the main ROM may be compressed or combined with another image. > - * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW > - * is marked here since the boot video device will be the only enabled > - * video device at this point. > + * See pci_map_rom() for use of this flag. Before we mark the device > + * with IORESOURCE_ROM_SHADOW we have to check if this is or should become > + * the primary video card, since this quirk is ran for all video devices. > */ > > static void pci_fixup_video(struct pci_dev *pdev) > @@ -347,12 +347,13 @@ static void pci_fixup_video(struct pci_dev *pdev) > } > bus = bus->parent; > } > - pci_read_config_word(pdev, PCI_COMMAND, &config); > - if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { > - pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; > - dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); > - if (!vga_default_device()) > + if (!vga_default_device() || pdev == vga_default_device()) { > + pci_read_config_word(pdev, PCI_COMMAND, &config); > + if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { > + pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; > + dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); > vga_set_default_device(pdev); > + } ia64 also has a pci_fixup_video() that is essentially the same. Can you fix that one as well, unless there is a reason why the fix applies only to x86 and not to ia64? > } > } > DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, > -- > 1.7.10.4