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

s390/cio: use bitwise types to allow for type checking

Change types of I/O structure members which contain physical addresses to
dma32_t and dma64_t bitwise types.

This allows to make use of sparse (aka "make C=1") to find incorrect usage
of physical addresses.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

+35 -27
+4 -3
arch/s390/include/asm/cio.h
··· 7 7 8 8 #include <linux/bitops.h> 9 9 #include <linux/genalloc.h> 10 + #include <asm/dma-types.h> 10 11 #include <asm/types.h> 11 12 #include <asm/tpi.h> 12 13 ··· 33 32 __u8 cmd_code; 34 33 __u8 flags; 35 34 __u16 count; 36 - __u32 cda; 35 + dma32_t cda; 37 36 } __attribute__ ((packed,aligned(8))); 38 37 39 38 /** ··· 153 152 struct esw0 { 154 153 struct sublog sublog; 155 154 struct erw erw; 156 - __u32 faddr[2]; 157 - __u32 saddr; 155 + dma32_t faddr[2]; 156 + dma32_t saddr; 158 157 } __attribute__ ((packed)); 159 158 160 159 /**
+3 -2
arch/s390/include/asm/eadm.h
··· 5 5 #include <linux/types.h> 6 6 #include <linux/device.h> 7 7 #include <linux/blk_types.h> 8 + #include <asm/dma-types.h> 8 9 9 10 struct arqb { 10 11 u64 data; ··· 46 45 u16:12; 47 46 u16 bs:4; 48 47 u32 blk_count; 49 - u64 data_addr; 48 + dma64_t data_addr; 50 49 u64 scm_addr; 51 50 u64:64; 52 51 } __packed; ··· 55 54 u8 flags; 56 55 u32 :24; 57 56 u32 :32; 58 - u64 data_addr; 57 + dma64_t data_addr; 59 58 } __packed; 60 59 61 60 #define MSB_OC_CLEAR 0
+7 -6
arch/s390/include/asm/fcx.h
··· 10 10 #define _ASM_S390_FCX_H 11 11 12 12 #include <linux/types.h> 13 + #include <asm/dma-types.h> 13 14 14 15 #define TCW_FORMAT_DEFAULT 0 15 16 #define TCW_TIDAW_FORMAT_DEFAULT 0 ··· 44 43 u32 r:1; 45 44 u32 w:1; 46 45 u32 :16; 47 - u64 output; 48 - u64 input; 49 - u64 tsb; 50 - u64 tccb; 46 + dma64_t output; 47 + dma64_t input; 48 + dma64_t tsb; 49 + dma64_t tccb; 51 50 u32 output_count; 52 51 u32 input_count; 53 52 u32 :32; 54 53 u32 :32; 55 54 u32 :32; 56 - u32 intrg; 55 + dma32_t intrg; 57 56 } __attribute__ ((packed, aligned(64))); 58 57 59 58 #define TIDAW_FLAGS_LAST (1 << (7 - 0)) ··· 74 73 u32 flags:8; 75 74 u32 :24; 76 75 u32 count; 77 - u64 addr; 76 + dma64_t addr; 78 77 } __attribute__ ((packed, aligned(16))); 79 78 80 79 /**
+9 -8
arch/s390/include/asm/qdio.h
··· 9 9 #define __QDIO_H__ 10 10 11 11 #include <linux/interrupt.h> 12 - #include <asm/cio.h> 12 + #include <asm/dma-types.h> 13 13 #include <asm/ccwdev.h> 14 + #include <asm/cio.h> 14 15 15 16 /* only use 4 queues to save some cachelines */ 16 17 #define QDIO_MAX_QUEUES_PER_IRQ 4 ··· 35 34 * @dkey: access key for SLSB 36 35 */ 37 36 struct qdesfmt0 { 38 - u64 sliba; 39 - u64 sla; 40 - u64 slsba; 37 + dma64_t sliba; 38 + dma64_t sla; 39 + dma64_t slsba; 41 40 u32 : 32; 42 41 u32 akey : 4; 43 42 u32 bkey : 4; ··· 75 74 /* private: */ 76 75 u32 res[9]; 77 76 /* public: */ 78 - u64 qiba; 77 + dma64_t qiba; 79 78 u32 : 32; 80 79 u32 qkey : 4; 81 80 u32 : 28; ··· 147 146 u8 flags; 148 147 u16 cbtbs; 149 148 u8 sb_count; 150 - u64 sba[QDIO_MAX_ELEMENTS_PER_BUFFER]; 149 + dma64_t sba[QDIO_MAX_ELEMENTS_PER_BUFFER]; 151 150 u16 dcount[QDIO_MAX_ELEMENTS_PER_BUFFER]; 152 151 u64 user0; 153 152 u64 res4[2]; ··· 209 208 u8 scount; 210 209 u8 sflags; 211 210 u32 length; 212 - u64 addr; 211 + dma64_t addr; 213 212 } __attribute__ ((packed, aligned(16))); 214 213 215 214 /** ··· 225 224 * @sbal: absolute SBAL address 226 225 */ 227 226 struct sl_element { 228 - u64 sbal; 227 + dma64_t sbal; 229 228 } __attribute__ ((packed)); 230 229 231 230 /**
+4 -3
arch/s390/include/asm/scsw.h
··· 11 11 12 12 #include <linux/types.h> 13 13 #include <asm/css_chars.h> 14 + #include <asm/dma-types.h> 14 15 #include <asm/cio.h> 15 16 16 17 /** ··· 54 53 __u32 fctl : 3; 55 54 __u32 actl : 7; 56 55 __u32 stctl : 5; 57 - __u32 cpa; 56 + dma32_t cpa; 58 57 __u32 dstat : 8; 59 58 __u32 cstat : 8; 60 59 __u32 count : 16; ··· 94 93 u32 fctl:3; 95 94 u32 actl:7; 96 95 u32 stctl:5; 97 - u32 tcw; 96 + dma32_t tcw; 98 97 u32 dstat:8; 99 98 u32 cstat:8; 100 99 u32 fcxs:8; ··· 126 125 u32 fctl:3; 127 126 u32 actl:7; 128 127 u32 stctl:5; 129 - u32 aob; 128 + dma32_t aob; 130 129 u32 dstat:8; 131 130 u32 cstat:8; 132 131 u32:16;
+2 -2
drivers/s390/cio/chsc.h
··· 91 91 u16:16; 92 92 u32:32; 93 93 u32:32; 94 - u64 summary_indicator_addr; 95 - u64 subchannel_indicator_addr; 94 + dma64_t summary_indicator_addr; 95 + dma64_t subchannel_indicator_addr; 96 96 u32 ks:4; 97 97 u32 kc:4; 98 98 u32:21;
+6 -3
drivers/s390/cio/orb.h
··· 12 12 #ifndef S390_ORB_H 13 13 #define S390_ORB_H 14 14 15 + #include <linux/types.h> 16 + #include <asm/dma-types.h> 17 + 15 18 /* 16 19 * Command-mode operation request block 17 20 */ ··· 37 34 u32 ils:1; /* incorrect length */ 38 35 u32 zero:6; /* reserved zeros */ 39 36 u32 orbx:1; /* ORB extension control */ 40 - u32 cpa; /* channel program address */ 37 + dma32_t cpa; /* channel program address */ 41 38 } __packed __aligned(4); 42 39 43 40 /* ··· 52 49 u32 lpm:8; 53 50 u32:7; 54 51 u32 x:1; 55 - u32 tcw; 52 + dma32_t tcw; 56 53 u32 prio:8; 57 54 u32:8; 58 55 u32 rsvpgm:8; ··· 74 71 u32 compat2:1; 75 72 u32:21; 76 73 u32 x:1; 77 - u32 aob; 74 + dma32_t aob; 78 75 u32 css_prio:8; 79 76 u32:8; 80 77 u32 scm_prio:8;