Hi Sven, I love your patch! Perhaps something to improve:
[auto build test WARNING on iommu/next] [also build test WARNING on v5.14-rc7 next-20210827] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sven-Peter/Support-IOMMU-page-sizes-larger-than-the-CPU-page-size/20210828-233909 base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next config: x86_64-randconfig-m001-20210827 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/fa978f84667cfd7d8cb467899da60c08321798a5 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sven-Peter/Support-IOMMU-page-sizes-larger-than-the-CPU-page-size/20210828-233909 git checkout fa978f84667cfd7d8cb467899da60c08321798a5 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <l...@intel.com> All warnings (new ones prefixed by >>): drivers/iommu/dma-iommu.c: In function '__finalise_sg': drivers/iommu/dma-iommu.c:935:18: error: implicit declaration of function 'phys_to_page'; did you mean 'pfn_to_page'? [-Werror=implicit-function-declaration] 935 | sg_set_page(s, phys_to_page(sg_phys(s) + s_iova_off), s_length, | ^~~~~~~~~~~~ | pfn_to_page >> drivers/iommu/dma-iommu.c:935:18: warning: passing argument 2 of >> 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion] 935 | sg_set_page(s, phys_to_page(sg_phys(s) + s_iova_off), s_length, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | int In file included from include/linux/dma-mapping.h:10, from include/linux/dma-map-ops.h:9, from drivers/iommu/dma-iommu.c:13: include/linux/scatterlist.h:110:69: note: expected 'struct page *' but argument is of type 'int' 110 | static inline void sg_set_page(struct scatterlist *sg, struct page *page, | ~~~~~~~~~~~~~^~~~ drivers/iommu/dma-iommu.c: In function '__invalidate_sg': drivers/iommu/dma-iommu.c:982:9: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion] 982 | phys_to_page(sg_phys(s) + sg_dma_address(s)), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | int In file included from include/linux/dma-mapping.h:10, from include/linux/dma-map-ops.h:9, from drivers/iommu/dma-iommu.c:13: include/linux/scatterlist.h:110:69: note: expected 'struct page *' but argument is of type 'int' 110 | static inline void sg_set_page(struct scatterlist *sg, struct page *page, | ~~~~~~~~~~~~~^~~~ drivers/iommu/dma-iommu.c: In function 'iommu_dma_map_sg': drivers/iommu/dma-iommu.c:1068:18: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion] 1068 | sg_set_page(s, phys_to_page(s_phys - s_iova_off), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | int In file included from include/linux/dma-mapping.h:10, from include/linux/dma-map-ops.h:9, from drivers/iommu/dma-iommu.c:13: include/linux/scatterlist.h:110:69: note: expected 'struct page *' but argument is of type 'int' 110 | static inline void sg_set_page(struct scatterlist *sg, struct page *page, | ~~~~~~~~~~~~~^~~~ cc1: some warnings being treated as errors vim +/sg_set_page +935 drivers/iommu/dma-iommu.c 913 914 /* 915 * Prepare a successfully-mapped scatterlist to give back to the caller. 916 * 917 * At this point the segments are already laid out by iommu_dma_map_sg() to 918 * avoid individually crossing any boundaries, so we merely need to check a 919 * segment's start address to avoid concatenating across one. 920 */ 921 static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents, 922 dma_addr_t dma_addr) 923 { 924 struct scatterlist *s, *cur = sg; 925 unsigned long seg_mask = dma_get_seg_boundary(dev); 926 unsigned int cur_len = 0, max_len = dma_get_max_seg_size(dev); 927 int i, count = 0; 928 929 for_each_sg(sg, s, nents, i) { 930 /* Restore this segment's original unaligned fields first */ 931 unsigned int s_iova_off = sg_dma_address(s); 932 unsigned int s_length = sg_dma_len(s); 933 unsigned int s_iova_len = s->length; 934 > 935 sg_set_page(s, phys_to_page(sg_phys(s) + s_iova_off), > s_length, 936 s_iova_off & ~PAGE_MASK); 937 sg_dma_address(s) = DMA_MAPPING_ERROR; 938 sg_dma_len(s) = 0; 939 940 /* 941 * Now fill in the real DMA data. If... 942 * - there is a valid output segment to append to 943 * - and this segment starts on an IOVA page boundary 944 * - but doesn't fall at a segment boundary 945 * - and wouldn't make the resulting output segment too long 946 */ 947 if (cur_len && !s_iova_off && (dma_addr & seg_mask) && 948 (max_len - cur_len >= s_length)) { 949 /* ...then concatenate it with the previous one */ 950 cur_len += s_length; 951 } else { 952 /* Otherwise start the next output segment */ 953 if (i > 0) 954 cur = sg_next(cur); 955 cur_len = s_length; 956 count++; 957 958 sg_dma_address(cur) = dma_addr + s_iova_off; 959 } 960 961 sg_dma_len(cur) = cur_len; 962 dma_addr += s_iova_len; 963 964 if (s_length + s_iova_off < s_iova_len) 965 cur_len = 0; 966 } 967 return count; 968 } 969 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
.config.gz
Description: application/gzip
_______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu