From: Ben Hutchings <ben@decadent.org.uk>
To: David Airlie <airlied@linux.ie>
Cc: linux-pci@vger.kernel.org, dri-devel@lists.sourceforge.net,
zhenyuw@linux.intel.com, Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH] agpgart: Reprobe VGA devices when a new GART device is added
Date: Sun, 28 Feb 2010 03:30:51 +0000 [thread overview]
Message-ID: <1267327851.2282.8.camel@localhost> (raw)
This addresses <http://bugzilla.kernel.org/show_bug.cgi?id=15021>.
DRM drivers may fail to probe their devices when the associated AGP
GART does not yet have a driver, so we reprobe unbound VGA devices
when a GART device is added.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
This is intended to address the dependency problem highlighted in the
above bug report. That specific bug can be fixed by adding a module
dependency from i915 to intel_agp, but in general there is no fixed
relationship betweem DRM and GART drivers.
There is a narrow race between the check for a current driver binding
and the call to device_reprobe(). This could be closed by adding a
variant on device_attach() and device_reprobe() that is a no-op for
bound devices.
Ben.
drivers/char/agp/backend.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index c3ab46d..f9680bf 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -36,6 +36,7 @@
#include <linux/agp_backend.h>
#include <linux/agpgart.h>
#include <linux/vmalloc.h>
+#include <linux/workqueue.h>
#include <asm/io.h>
#include "agp.h"
@@ -281,6 +282,24 @@ void agp_put_bridge(struct agp_bridge_data *bridge)
EXPORT_SYMBOL(agp_put_bridge);
+/*
+ * DRM drivers may fail to probe their devices when the associated AGP
+ * GART does not yet have a driver, so we reprobe unbound VGA devices
+ * when a GART device is added. This problem applies not only to true
+ * AGP devices which would be children of the affected bridge, but
+ * also to PCI Express devices that may be siblings of the GART
+ * device. Therefore iterate over all PCI VGA devices.
+ */
+static void agp_probe_video(struct work_struct *work)
+{
+ struct pci_dev *pdev = NULL;
+
+ while ((pdev = pci_get_class(0x030000, pdev)) != NULL) {
+ if (!pdev->dev.driver && device_reprobe(&pdev->dev))
+ pr_err(PFX "failed to reprobe %s\n", pci_name(pdev));
+}
+static DECLARE_WORK(agp_probe_video_work, agp_probe_video);
+
int agp_add_bridge(struct agp_bridge_data *bridge)
{
int error;
@@ -324,6 +343,7 @@ int agp_add_bridge(struct agp_bridge_data *bridge)
}
list_add(&bridge->list, &agp_bridges);
+ schedule_work(&agp_probe_video_work);
return 0;
frontend_err:
--
1.6.6.2
next reply other threads:[~2010-02-28 3:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-28 3:30 Ben Hutchings [this message]
2010-02-28 13:53 ` [PATCH] agpgart: Reprobe VGA devices when a new GART device is added Ben Hutchings
2010-03-01 8:33 ` Dave Airlie
2010-03-01 16:19 ` Eric Anholt
2010-03-01 17:40 ` Ben Hutchings
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=1267327851.2282.8.camel@localhost \
--to=ben@decadent.org.uk \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.sourceforge.net \
--cc=gregkh@suse.de \
--cc=linux-pci@vger.kernel.org \
--cc=zhenyuw@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.