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

powerpc/cell: Fix iommu exception reporting

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>

authored by

Jeremy Kerr and committed by
Benjamin Herrenschmidt
2a7d55fd 2319f123

+5 -4
+5 -4
arch/powerpc/platforms/cell/iommu.c
··· 74 74 #define IOC_IO_ExcpStat_V 0x8000000000000000ul 75 75 #define IOC_IO_ExcpStat_SPF_Mask 0x6000000000000000ul 76 76 #define IOC_IO_ExcpStat_SPF_S 0x6000000000000000ul 77 - #define IOC_IO_ExcpStat_SPF_P 0x4000000000000000ul 77 + #define IOC_IO_ExcpStat_SPF_P 0x2000000000000000ul 78 78 #define IOC_IO_ExcpStat_ADDR_Mask 0x00000007fffff000ul 79 79 #define IOC_IO_ExcpStat_RW_Mask 0x0000000000000800ul 80 80 #define IOC_IO_ExcpStat_IOID_Mask 0x00000000000007fful ··· 247 247 248 248 static irqreturn_t ioc_interrupt(int irq, void *data) 249 249 { 250 - unsigned long stat; 250 + unsigned long stat, spf; 251 251 struct cbe_iommu *iommu = data; 252 252 253 253 stat = in_be64(iommu->xlate_regs + IOC_IO_ExcpStat); 254 + spf = stat & IOC_IO_ExcpStat_SPF_Mask; 254 255 255 256 /* Might want to rate limit it */ 256 257 printk(KERN_ERR "iommu: DMA exception 0x%016lx\n", stat); 257 258 printk(KERN_ERR " V=%d, SPF=[%c%c], RW=%s, IOID=0x%04x\n", 258 259 !!(stat & IOC_IO_ExcpStat_V), 259 - (stat & IOC_IO_ExcpStat_SPF_S) ? 'S' : ' ', 260 - (stat & IOC_IO_ExcpStat_SPF_P) ? 'P' : ' ', 260 + (spf == IOC_IO_ExcpStat_SPF_S) ? 'S' : ' ', 261 + (spf == IOC_IO_ExcpStat_SPF_P) ? 'P' : ' ', 261 262 (stat & IOC_IO_ExcpStat_RW_Mask) ? "Read" : "Write", 262 263 (unsigned int)(stat & IOC_IO_ExcpStat_IOID_Mask)); 263 264 printk(KERN_ERR " page=0x%016lx\n",