From: Bjorn Helgaas <bhelgaas@google.com>
To: Sander Eikelenboom <linux@eikelenboom.it>
Cc: eiichiro.oiwa.nm@hitachi.com, Dave Airlie <airlied@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-pci@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
Date: Wed, 29 Jan 2014 17:08:31 -0700 [thread overview]
Message-ID: <20140130000831.GJ16825@google.com> (raw)
In-Reply-To: <1524137311.20140115232528@eikelenboom.it>
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 <airlied@redhat.com>,
> Eiichiro Oiwa <eiichiro.oiwa.nm@hitachi.com>,
> Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
> linux-kernel@vger.kernel.org <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 <linux@eikelenboom.it>
> ---
> 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
next prev parent reply other threads:[~2014-01-30 0:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1389499841-6097-1-git-send-email-linux@eikelenboom.it>
[not found] ` <XNM1$9$0$4$$3$3$7$A$9006858U52d4d109@hitachi.com>
[not found] ` <6310129377.20140114162641@eikelenboom.it>
[not found] ` <XNM1$9$0$4$$3$3$7$A$9006860U52d614ca@hitachi.com>
2014-01-15 19:36 ` In "pci_fixup_video" check if this is or should be the primary video devi Sander Eikelenboom
2014-01-15 21:50 ` Bjorn Helgaas
2014-01-15 22:25 ` Sander Eikelenboom
[not found] ` <XNM1$9$0$4$$3$3$7$A$9006862U52d758ed@hitachi.com>
2014-01-16 13:19 ` In "pci_fixup_video" check if this is or should be the primary video d Bjorn Helgaas
2014-01-30 0:08 ` Bjorn Helgaas [this message]
2014-01-31 9:28 ` [PATCH v2] Setting the IORESOURCE_ROM_SHADOW flag on a VGA card other than the primary prevents it 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 Sander Eikelenboom
2014-01-31 9:28 ` Sander Eikelenboom
2014-02-03 14:52 ` Konrad Rzeszutek Wilk
2014-02-07 11:03 ` Sander Eikelenboom
2014-02-13 9:48 ` Sander Eikelenboom
2014-02-14 20:26 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140130000831.GJ16825@google.com \
--to=bhelgaas@google.com \
--cc=airlied@redhat.com \
--cc=eiichiro.oiwa.nm@hitachi.com \
--cc=gregkh@linuxfoundation.org \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@eikelenboom.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).