]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
powerpc/cell: Fix iommu exception reporting
authorJeremy Kerr <jk@ozlabs.org>
Thu, 19 Mar 2009 16:46:35 +0000 (16:46 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 24 Mar 2009 02:47:32 +0000 (13:47 +1100)
Currently, we will report a page fault as a segment fault, and report
a segment fault as both a page and segment fault.

Fix the SPF_P definition to be correct according to the iommu docs, and
mask before comparing.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/cell/iommu.c

index ee5033eddf019de7a31b5ac8c3de1ec25e646d55..5744527a7f2ac777bd9c94985c71e47ff4afd146 100644 (file)
@@ -74,7 +74,7 @@
 #define IOC_IO_ExcpStat_V              0x8000000000000000ul
 #define IOC_IO_ExcpStat_SPF_Mask       0x6000000000000000ul
 #define IOC_IO_ExcpStat_SPF_S          0x6000000000000000ul
-#define IOC_IO_ExcpStat_SPF_P          0x4000000000000000ul
+#define IOC_IO_ExcpStat_SPF_P          0x2000000000000000ul
 #define IOC_IO_ExcpStat_ADDR_Mask      0x00000007fffff000ul
 #define IOC_IO_ExcpStat_RW_Mask                0x0000000000000800ul
 #define IOC_IO_ExcpStat_IOID_Mask      0x00000000000007fful
@@ -247,17 +247,18 @@ static void tce_free_cell(struct iommu_table *tbl, long index, long npages)
 
 static irqreturn_t ioc_interrupt(int irq, void *data)
 {
-       unsigned long stat;
+       unsigned long stat, spf;
        struct cbe_iommu *iommu = data;
 
        stat = in_be64(iommu->xlate_regs + IOC_IO_ExcpStat);
+       spf = stat & IOC_IO_ExcpStat_SPF_Mask;
 
        /* Might want to rate limit it */
        printk(KERN_ERR "iommu: DMA exception 0x%016lx\n", stat);
        printk(KERN_ERR "  V=%d, SPF=[%c%c], RW=%s, IOID=0x%04x\n",
               !!(stat & IOC_IO_ExcpStat_V),
-              (stat & IOC_IO_ExcpStat_SPF_S) ? 'S' : ' ',
-              (stat & IOC_IO_ExcpStat_SPF_P) ? 'P' : ' ',
+              (spf == IOC_IO_ExcpStat_SPF_S) ? 'S' : ' ',
+              (spf == IOC_IO_ExcpStat_SPF_P) ? 'P' : ' ',
               (stat & IOC_IO_ExcpStat_RW_Mask) ? "Read" : "Write",
               (unsigned int)(stat & IOC_IO_ExcpStat_IOID_Mask));
        printk(KERN_ERR "  page=0x%016lx\n",