linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Andreas Noever <andreas.noever@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	DRI mailing list <dri-devel@lists.freedesktop.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	Dave Airlie <airlied@linux.ie>,
	Matthew Garrett <matthew.garrett@nebula.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH 2/2] x86, ia64: Don't default to first video device
Date: Sat, 16 Aug 2014 19:30:39 +0200	[thread overview]
Message-ID: <20140816193039.76304abb@neptune.home> (raw)
In-Reply-To: <20140816192135.34260115@neptune.home>

With commit 20cde694027e boot video device detection was moved from
efifb to x86 and ia64 pci/fixup.c.

For dual-GPU Apple computers above above change represents a regression
as code in efifb did forcefully override vga_default_device while the
merge did not (changed ordering of actions).

This stops setting default_vga_device when applying
IORESOURCE_ROM_SHADOW (only doing so for the detected boot GPU) and
updates logging of boot video device selection, in vgaarb which covers
VGA text-mode booting and first half of pci_fixup_video which covers
framebuffer mode (EFI, VESA).

By setting IORESOURCE_ROM_SHADOW only on effective boot GPU we also
corrects a longstanding complaint from intel driver as reported by
Andreas:
  > Does setting the ROM_SHADOW flag on (possibly) the wrong device
  > have any effect?
  Yes it does. Removing the line changes a long standing
    i915 0000:00:02.0: Invalid ROM contents
  into a
    i915 0000:00:02.0: BAR 6: can't assign [??? 0x00000000 flags
    0x20000000] (bogus alignment).
  The first is logged at KERN_ERR while the second is at KERN_INFO.

Reported-By: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
CC: Matthew Garrett <matthew.garrett@nebula.com>
CC: stable@vger.kernel.org # v3.5+
---
Must be applied to stable when upstream commit
20cde694027e7477cc532833e38ab9fcaa83fb64, which is marked for
stable, gets applied.

Can be applied without patch 1/2 from this series though dropped
#ifndefs will cause this patch not to apply cleanly.


 arch/ia64/pci/fixup.c    | 9 +++++----
 arch/x86/pci/fixup.c     | 9 +++++----
 drivers/gpu/vga/vgaarb.c | 4 +++-
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index ec73b2c..05198f8 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -54,8 +54,10 @@ static void pci_fixup_video(struct pci_dev *pdev)
 				continue;
 
 			if (screen_info.lfb_base >= start &&
-			    (screen_info.lfb_base + screen_info.lfb_size) < end)
+			    (screen_info.lfb_base + screen_info.lfb_size) < end) {
+				dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
 				vga_set_default_device(pdev);
+			}
 		}
 	}
 
@@ -79,12 +81,11 @@ static void pci_fixup_video(struct pci_dev *pdev)
 		}
 		bus = bus->parent;
 	}
-	if (!vga_default_device() || pdev == vga_default_device()) {
+	if (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);
+			dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
 		}
 	}
 }
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index c61ea57..5b392d2 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -342,8 +342,10 @@ static void pci_fixup_video(struct pci_dev *pdev)
 				continue;
 
 			if (screen_info.lfb_base >= start &&
-			    (screen_info.lfb_base + screen_info.lfb_size) < end)
+			    (screen_info.lfb_base + screen_info.lfb_size) < end) {
+				dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
 				vga_set_default_device(pdev);
+			}
 		}
 	}
 
@@ -367,12 +369,11 @@ static void pci_fixup_video(struct pci_dev *pdev)
 		}
 		bus = bus->parent;
 	}
-	if (!vga_default_device() || pdev == vga_default_device()) {
+	if (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);
+			dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
 		}
 	}
 }
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index 257674d..c6eeed5 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -580,8 +580,10 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)
 	 * by default if arch doesn't have it's own hook
 	 */
 	if (vga_default == NULL &&
-	    ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK))
+	    ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) {
+		pr_info("vgaarb: Boot video device: PCI:%s\n", pci_name(pdev));
 		vga_set_default_device(pdev);
+	}
 
 	vga_arbiter_check_bridge_sharing(vgadev);
 
-- 
1.8.5.5


  parent reply	other threads:[~2014-08-16 17:31 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 20:43 [Patch] x86, ia64, efifb: Move boot_vga fixup from pci to vgaarb Bruno Prémont
2014-05-27 23:42 ` Bjorn Helgaas
2014-06-02 18:16   ` Bruno Prémont
2014-06-02 18:19     ` [PATCH 2/2] x86, ia64: Merge common vga fixup code Bruno Prémont
2014-06-02 18:19     ` [PATCH 1/2] x86, ia64: Move EFI_FB vga_default_device() initialization to pci_vga_fixup() Bruno Prémont
2014-06-17 22:35       ` Bjorn Helgaas
2014-06-18  6:09         ` Bruno Prémont
2014-06-24 20:41       ` Bruno Prémont
2014-06-24 22:55       ` [PATCH 1/2 v2] " Bruno Prémont
2014-06-24 22:58         ` [PATCH 2/2 v2] x86, ia64: Merge common vga fixup code Bruno Prémont
2014-06-24 23:02         ` [PATCH 1/2 v2] x86, ia64: Move EFI_FB vga_default_device() initialization to pci_vga_fixup() Matthew Garrett
2014-07-05 17:15         ` Bjorn Helgaas
2014-08-10  0:21           ` Andreas Noever
2014-08-10  0:36             ` Andreas Noever
2014-08-10  9:26               ` Bruno Prémont
2014-08-10  9:56                 ` Andreas Noever
2014-08-10 16:34                   ` Bruno Prémont
2014-08-14  0:40                     ` Andreas Noever
2014-08-16 17:21                       ` [PATCH 0/2] " Bruno Prémont
2014-08-16 17:25                         ` [PATCH 1/2] vgaarb: Drop obsolete #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE Bruno Prémont
2014-08-16 17:30                         ` Bruno Prémont [this message]
2014-08-19 15:45                         ` [PATCH 0/2] x86, ia64: Move EFI_FB vga_default_device() initialization to pci_vga_fixup() Andreas Noever
2014-08-20  5:55                           ` Bruno Prémont
2014-08-20  7:11                             ` Bruno Prémont
     [not found]                               ` <CAMxnaaUodONkqmdPWedN-Q1qheHiJAScFcG_XbX1--ZmiOQZDg@mail.gmail.com>
2014-08-21 21:34                                 ` Bruno Prémont
2014-08-22  4:39                                   ` Bjorn Helgaas
2014-08-22  6:23                                     ` Bruno Prémont
     [not found]                                       ` <CAMxnaaU9EiMcne-aQjS1sY1Orn6xGbVHEnd057ogcZ77p74Y=Q@mail.gmail.com>
2014-08-23 11:06                                         ` Bruno Prémont
2014-08-24 21:09                                           ` [PATCH 1/2 v2] vgaarb: Don't default exclusively to first video device with mem+io Bruno Prémont
2014-08-26 15:32                                             ` Andreas Noever
2014-08-28 20:47                                               ` Bruno Prémont
2014-09-12 11:19                                                 ` Bruno Prémont
2014-09-12 14:28                                                   ` Bjorn Helgaas
2014-09-18 23:26                                                     ` Dave Airlie
2014-09-19  5:18                                                       ` Bjorn Helgaas
2014-08-24 21:13                                           ` [PATCH 2/2 v2] vgaarb: Drop obsolete #ifndef Bruno Prémont
2014-08-25 12:16                                       ` [PATCH 0/2] x86, ia64: Move EFI_FB vga_default_device() initialization to pci_vga_fixup() Daniel Vetter
2014-08-25 12:39                                         ` Bruno Prémont

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=20140816193039.76304abb@neptune.home \
    --to=bonbons@linux-vserver.org \
    --cc=airlied@linux.ie \
    --cc=andreas.noever@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    /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).