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

sparc32: fix sparse warning in iommu.c

Fix following warning:
iommu.c:69:21: warning: incorrect type in assignment (different address spaces)

iommu_struct.regs is __iomem - fix up all users.
Introduce sbus operations for all read/write operations.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Sam Ravnborg and committed by
David S. Miller
f977ea49 178f0ffa

+18 -12
+5 -5
arch/sparc/include/asm/iommu_32.h
··· 99 99 #define IOPTE_WAZ 0x00000001 /* Write as zeros */ 100 100 101 101 struct iommu_struct { 102 - struct iommu_regs *regs; 102 + struct iommu_regs __iomem *regs; 103 103 iopte_t *page_table; 104 104 /* For convenience */ 105 105 unsigned long start; /* First managed virtual address */ ··· 108 108 struct bit_map usemap; 109 109 }; 110 110 111 - static inline void iommu_invalidate(struct iommu_regs *regs) 111 + static inline void iommu_invalidate(struct iommu_regs __iomem *regs) 112 112 { 113 - regs->tlbflush = 0; 113 + sbus_writel(0, &regs->tlbflush); 114 114 } 115 115 116 - static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) 116 + static inline void iommu_invalidate_page(struct iommu_regs __iomem *regs, unsigned long ba) 117 117 { 118 - regs->pageflush = (ba & PAGE_MASK); 118 + sbus_writel(ba & PAGE_MASK, &regs->pageflush); 119 119 } 120 120 121 121 #endif /* !(_SPARC_IOMMU_H) */
+13 -7
arch/sparc/mm/iommu.c
··· 58 58 struct iommu_struct *iommu; 59 59 unsigned int impl, vers; 60 60 unsigned long *bitmap; 61 + unsigned long control; 62 + unsigned long base; 61 63 unsigned long tmp; 62 64 63 65 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); ··· 74 72 prom_printf("Cannot map IOMMU registers\n"); 75 73 prom_halt(); 76 74 } 77 - impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28; 78 - vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24; 79 - tmp = iommu->regs->control; 80 - tmp &= ~(IOMMU_CTRL_RNGE); 81 - tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); 82 - iommu->regs->control = tmp; 75 + 76 + control = sbus_readl(&iommu->regs->control); 77 + impl = (control & IOMMU_CTRL_IMPL) >> 28; 78 + vers = (control & IOMMU_CTRL_VERS) >> 24; 79 + control &= ~(IOMMU_CTRL_RNGE); 80 + control |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); 81 + sbus_writel(control, &iommu->regs->control); 82 + 83 83 iommu_invalidate(iommu->regs); 84 84 iommu->start = IOMMU_START; 85 85 iommu->end = 0xffffffff; ··· 103 99 memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); 104 100 flush_cache_all(); 105 101 flush_tlb_all(); 106 - iommu->regs->base = __pa((unsigned long) iommu->page_table) >> 4; 102 + 103 + base = __pa((unsigned long)iommu->page_table) >> 4; 104 + sbus_writel(base, &iommu->regs->base); 107 105 iommu_invalidate(iommu->regs); 108 106 109 107 bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL);