Skip to contentSkip to conversation

drm/radeon: Add early unregister of firmware fb's

PATCH In review Benjamin Herrenschmidt 2 participants 3 messages Aug 10, 2010 – Aug 16, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon: Add early unregister of firmware fb's

Without this, we attempt the handover too late, the firmware fb might be accessing the chip simultaneously to us re-initializing various parts of it, which might frighten babies or cause all sort of nasty psychologic trauma to kitten.

---
 drivers/gpu/drm/radeon/radeon_device.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_device.c +18 -0
index cc1464b..9a3e6ba 100644
@@ -594,6 +594,21 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
 }
 
 
+static void radeon_kick_out_firmware_fb(struct drm_device *ddev)
+{
+	struct apertures_struct *ap;
+	bool primary = false;
+
+	ap = alloc_apertures(1);
+	ap->ranges[0].base = drm_get_resource_start(ddev, 0);
+	ap->ranges[0].size = drm_get_resource_len(ddev, 0);
+
+#ifdef CONFIG_X86
+	primary = dev->pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
+#endif
+	remove_conflicting_framebuffers(ap, "radeondrmfb", primary);
+}
+
 int radeon_device_init(struct radeon_device *rdev,
 		       struct drm_device *ddev,
 		       struct pci_dev *pdev,
@@ -633,6 +648,9 @@ int radeon_device_init(struct radeon_device *rdev,
 	init_waitqueue_head(&rdev->irq.vblank_queue);
 	init_waitqueue_head(&rdev->irq.idle_queue);
 
+	/* Get rid of things like offb */
+	radeon_kick_out_firmware_fb(ddev);
+
 	/* setup workqueue */
 	rdev->wq = create_workqueue("radeon");
 	if (rdev->wq == NULL)
#1 lore raw

2010/8/10 Benjamin Herrenschmidt <[email protected]>:

drivers/gpu/drm/radeon/radeon_device.c static bool radeon_switcheroo_can_switch(struct pci_dev *pdev) · line 608

Quoted 3 lines
drivers/gpu/drm/radeon/radeon_device.c +3 -0
+#ifdef CONFIG_X86
+       primary = dev->pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
+#endif

It won't compile for CONFIG_X86, no "dev".

Signature · 5 lines
Rafał
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 7 lines · Rafał Miłecki

2010/8/10 Benjamin Herrenschmidt <[email protected]>:

Review

Quoted 2 lines
(quoted diff) +2 -0
+#ifdef CONFIG_X86
+       primary = dev->pdev->resource[PCI_ROM_RESOURCE].flags &

IORESOURCE_ROM_SHADOW;

Quoted 1 line

+#endif

It won't compile for CONFIG_X86, no "dev".

Ah right, I've done more fixes, I'll send a new series soon.

Cheers,
Ben.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel