NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/52409: uvm_fault when waking up after sleep (Let's Note CF-{N,S}-9, etc.)



Hi,

> (1) In file sys/external/bsd/drm2/pci/drm_pci.c,
>    ---------------------
>    234  static int
>    235  drm_pci_irq_install(struct drm_device *dev, irqreturn_t (*handler)(void *),
>    236      int flags, const char *name, void *arg, struct drm_bus_irq_cookie **cookiep)
>
>         ... (omit) ...
>    253          intrstr = pci_intr_string(pa->pa_pc, irq_cookie->intr_handles[0],
>    254              intrbuf, sizeof(intrbuf));
>    ---------------------
>    at the line 253, irq_cookie->intr_handles == 0,
>    which causes following trap.

Could you try the attached patch?

Regards,
-- 
Kimihiro Nonaka
diff --git a/sys/external/bsd/drm2/pci/drm_pci.c b/sys/external/bsd/drm2/pci/drm_pci.c
index 9f3729e33dd..fc7132dab99 100644
--- a/sys/external/bsd/drm2/pci/drm_pci.c
+++ b/sys/external/bsd/drm2/pci/drm_pci.c
@@ -243,11 +243,17 @@ drm_pci_irq_install(struct drm_device *dev, irqreturn_t (*handler)(void *),
 	irq_cookie = kmem_alloc(sizeof(*irq_cookie), KM_SLEEP);
 
 	if (dev->pdev->msi_enabled) {
-		irq_cookie->intr_handles = dev->pdev->intr_handles;
-		dev->pdev->intr_handles = NULL;
+		if (dev->pdev->intr_handles == NULL) {
+			if (pci_msi_alloc_exact(pa, &irq_cookie->intr_handles,
+			    1))
+				goto error;
+		} else {
+			irq_cookie->intr_handles = dev->pdev->intr_handles;
+			dev->pdev->intr_handles = NULL;
+		}
 	} else {
 		if (pci_intx_alloc(pa, &irq_cookie->intr_handles))
-			return -ENOENT;
+			goto error;
 	}
 
 	intrstr = pci_intr_string(pa->pa_pc, irq_cookie->intr_handles[0],
@@ -257,12 +263,17 @@ drm_pci_irq_install(struct drm_device *dev, irqreturn_t (*handler)(void *),
 	if (irq_cookie->ih_cookie == NULL) {
 		aprint_error_dev(dev->dev,
 		    "couldn't establish interrupt at %s (%s)\n", intrstr, name);
-		return -ENOENT;
+		pci_intr_release(pa->pa_pc, irq_cookie->intr_handles, 1);
+		goto error;
 	}
 
 	aprint_normal_dev(dev->dev, "interrupting at %s (%s)\n", intrstr, name);
 	*cookiep = irq_cookie;
 	return 0;
+
+error:
+	kmem_free(irq_cookie, sizeof(*irq_cookie));
+	return -ENOENT;
 }
 
 static void


Home | Main Index | Thread Index | Old Index