s390/cio: introduce bitwise dma types and helper functions
authorHalil Pasic <pasic@linux.ibm.com>
Thu, 7 Mar 2024 12:28:05 +0000 (13:28 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 13 Mar 2024 08:23:45 +0000 (09:23 +0100)
commit8b19e145e82f1bf1419541de7ad823f5cb7a4ec3
treec3a2d3c2f2f064893464908c96f10a49c3710252
parent1c2be70e651306073e7ef0983b748465e93e651d
s390/cio: introduce bitwise dma types and helper functions

Introduce dma32_t and dma64_t bitwise types, which are supposed to be used
for 31 and 64 bit DMA capable addresses. This allows to use sparse (make
C=1) for type checking, so that incorrect usages can be easily found.

Also add a couple of helper functions which
- convert virtual to DMA addresses and vice versa
- allow for simple logical and arithmetic operations on DMA addresses
- convert DMA addresses to plain u32 and u64 values

All helper functions exist to avoid excessive casting in C code.

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Co-developed-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/dma-types.h [new file with mode: 0644]