Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nvc0/fb: slightly improve PMFB intr handling, move out of nvc0_graph.c

I'm still not certain how to determine the number of SUBPs are present on
a given board.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

+27 -18
+27
drivers/gpu/drm/nouveau/nvc0_fb.c
··· 32 32 dma_addr_t r100c10; 33 33 }; 34 34 35 + static inline void 36 + nvc0_mfb_subp_isr(struct drm_device *dev, int unit, int subp) 37 + { 38 + u32 subp_base = 0x141000 + (unit * 0x2000) + (subp * 0x400); 39 + u32 stat = nv_rd32(dev, subp_base + 0x020); 40 + 41 + if (stat) { 42 + NV_INFO(dev, "PMFB%d_SUBP%d: 0x%08x\n", unit, subp, stat); 43 + nv_wr32(dev, subp_base + 0x020, stat); 44 + } 45 + } 46 + 47 + static void 48 + nvc0_mfb_isr(struct drm_device *dev) 49 + { 50 + u32 units = nv_rd32(dev, 0x00017c); 51 + while (units) { 52 + u32 subp, unit = ffs(units) - 1; 53 + for (subp = 0; subp < 2; subp++) 54 + nvc0_mfb_subp_isr(dev, unit, subp); 55 + units &= ~(1 << unit); 56 + } 57 + } 58 + 35 59 static void 36 60 nvc0_fb_destroy(struct drm_device *dev) 37 61 { 38 62 struct drm_nouveau_private *dev_priv = dev->dev_private; 39 63 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; 40 64 struct nvc0_fb_priv *priv = pfb->priv; 65 + 66 + nouveau_irq_unregister(dev, 25); 41 67 42 68 if (priv->r100c10_page) { 43 69 pci_unmap_page(dev->pdev, priv->r100c10, PAGE_SIZE, ··· 100 74 return -EFAULT; 101 75 } 102 76 77 + nouveau_irq_register(dev, 25, nvc0_mfb_isr); 103 78 return 0; 104 79 } 105 80
-18
drivers/gpu/drm/nouveau/nvc0_graph.c
··· 700 700 nv_wr32(dev, 0x400500, 0x00010001); 701 701 } 702 702 703 - static void 704 - nvc0_runk140_isr(struct drm_device *dev) 705 - { 706 - u32 units = nv_rd32(dev, 0x00017c) & 0x1f; 707 - 708 - while (units) { 709 - u32 unit = ffs(units) - 1; 710 - u32 reg = 0x140000 + unit * 0x2000; 711 - u32 st0 = nv_mask(dev, reg + 0x1020, 0, 0); 712 - u32 st1 = nv_mask(dev, reg + 0x1420, 0, 0); 713 - 714 - NV_DEBUG(dev, "PRUNK140: %d 0x%08x 0x%08x\n", unit, st0, st1); 715 - units &= ~(1 << unit); 716 - } 717 - } 718 - 719 703 static int 720 704 nvc0_graph_create_fw(struct drm_device *dev, const char *fwname, 721 705 struct nvc0_graph_fuc *fuc) ··· 748 764 } 749 765 750 766 nouveau_irq_unregister(dev, 12); 751 - nouveau_irq_unregister(dev, 25); 752 767 753 768 nouveau_gpuobj_ref(NULL, &priv->unk4188b8); 754 769 nouveau_gpuobj_ref(NULL, &priv->unk4188b4); ··· 786 803 787 804 NVOBJ_ENGINE_ADD(dev, GR, &priv->base); 788 805 nouveau_irq_register(dev, 12, nvc0_graph_isr); 789 - nouveau_irq_register(dev, 25, nvc0_runk140_isr); 790 806 791 807 if (nouveau_ctxfw) { 792 808 NV_INFO(dev, "PGRAPH: using external firmware\n");