From patchwork Wed Jan 15 22:25:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sander Eikelenboom X-Patchwork-Id: 3495301 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A7EC79F169 for ; Wed, 15 Jan 2014 22:25:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD35220171 for ; Wed, 15 Jan 2014 22:25:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E456420166 for ; Wed, 15 Jan 2014 22:25:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755085AbaAOWZj (ORCPT ); Wed, 15 Jan 2014 17:25:39 -0500 Received: from vserver.eikelenboom.it ([84.200.39.61]:54460 "EHLO smtp.eikelenboom.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754029AbaAOWZh (ORCPT ); Wed, 15 Jan 2014 17:25:37 -0500 Received: from 207-69-ftth.on.nl ([88.159.69.207]:54586 helo=[172.16.1.20]) by smtp.eikelenboom.it with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1W3YiX-00084I-Av; Wed, 15 Jan 2014 23:13:45 +0100 Date: Wed, 15 Jan 2014 23:25:28 +0100 From: Sander Eikelenboom Organization: Eikelenboom IT services X-Priority: 3 (Normal) Message-ID: <1524137311.20140115232528@eikelenboom.it> To: Bjorn Helgaas 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 In-Reply-To: References: <1389499841-6097-1-git-send-email-linux@eikelenboom.it> <6310129377.20140114162641@eikelenboom.it> <126550032.20140115203605@eikelenboom.it> MIME-Version: 1.0 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Wednesday, January 15, 2014, 10:50:09 PM, you wrote: > On Wed, Jan 15, 2014 at 12:36 PM, Sander Eikelenboom > wrote: >> ... >> And that's just what my patch does .. >> >> + if (!vga_default_device() || pdev == vga_default_device()) { >> >> If we don't know the vga_default_device ... because we don't have that knowlegde >> or >> if this is actually the vga_default_device ... because we do have that knowledge .. >> >> and only then .. run the fixup code and set this device as the vga_default_device >> >> >> So this change actually makes the code adhere to the comment already above it .. saying it should only be applied to the vga_default_device aka >> boot video device. >> >> Also added Bjorn and linux-pci to the CC .. should have done that right away .. >> sorry for that. > Can you resend your patch to linux-pci? I don't think it made it there. > Bjorn Sure .. also attached for the case it gets mangled .. 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); + } } } DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,