Skip to content

Commit 2a7d55f

Browse files
jk-ozlabsozbenh
authored andcommitted
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>
1 parent 2319f12 commit 2a7d55f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎arch/powerpc/platforms/cell/iommu.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
#define IOC_IO_ExcpStat_V 0x8000000000000000ul
7575
#define IOC_IO_ExcpStat_SPF_Mask 0x6000000000000000ul
7676
#define IOC_IO_ExcpStat_SPF_S 0x6000000000000000ul
77-
#define IOC_IO_ExcpStat_SPF_P 0x4000000000000000ul
77+
#define IOC_IO_ExcpStat_SPF_P 0x2000000000000000ul
7878
#define IOC_IO_ExcpStat_ADDR_Mask 0x00000007fffff000ul
7979
#define IOC_IO_ExcpStat_RW_Mask 0x0000000000000800ul
8080
#define IOC_IO_ExcpStat_IOID_Mask 0x00000000000007fful
@@ -247,17 +247,18 @@ static void tce_free_cell(struct iommu_table *tbl, long index, long npages)
247247

248248
static irqreturn_t ioc_interrupt(int irq, void *data)
249249
{
250-
unsigned long stat;
250+
unsigned long stat, spf;
251251
struct cbe_iommu *iommu = data;
252252

253253
stat = in_be64(iommu->xlate_regs + IOC_IO_ExcpStat);
254+
spf = stat & IOC_IO_ExcpStat_SPF_Mask;
254255

255256
/* Might want to rate limit it */
256257
printk(KERN_ERR "iommu: DMA exception 0x%016lx\n", stat);
257258
printk(KERN_ERR " V=%d, SPF=[%c%c], RW=%s, IOID=0x%04x\n",
258259
!!(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' : ' ',
261262
(stat & IOC_IO_ExcpStat_RW_Mask) ? "Read" : "Write",
262263
(unsigned int)(stat & IOC_IO_ExcpStat_IOID_Mask));
263264
printk(KERN_ERR " page=0x%016lx\n",

0 commit comments

Comments
 (0)