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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'common_phys_vec_via_vfio' into v6.20/vfio/next

* Reuse common phys_vec, phase out dma_buf_phys_vec

Signed-off-by: Alex Williamson <alex@shazbot.org>

+33 -41
+5 -6
block/blk-mq-dma.c
··· 6 6 #include <linux/blk-mq-dma.h> 7 7 #include "blk.h" 8 8 9 - struct phys_vec { 10 - phys_addr_t paddr; 11 - u32 len; 12 - }; 13 - 14 9 static bool __blk_map_iter_next(struct blk_map_iter *iter) 15 10 { 16 11 if (iter->iter.bi_size) ··· 107 112 struct phys_vec *vec) 108 113 { 109 114 enum dma_data_direction dir = rq_dma_dir(req); 110 - unsigned int mapped = 0; 111 115 unsigned int attrs = 0; 116 + size_t mapped = 0; 112 117 int error; 113 118 114 119 iter->addr = state->addr; ··· 292 297 blk_rq_map_iter_init(rq, &iter); 293 298 while (blk_map_iter_next(rq, &iter, &vec)) { 294 299 *last_sg = blk_next_sg(last_sg, sglist); 300 + 301 + WARN_ON_ONCE(overflows_type(vec.len, unsigned int)); 295 302 sg_set_page(*last_sg, phys_to_page(vec.paddr), vec.len, 296 303 offset_in_page(vec.paddr)); 297 304 nsegs++; ··· 414 417 415 418 while (blk_map_iter_next(rq, &iter, &vec)) { 416 419 sg = blk_next_sg(&sg, sglist); 420 + 421 + WARN_ON_ONCE(overflows_type(vec.len, unsigned int)); 417 422 sg_set_page(sg, phys_to_page(vec.paddr), vec.len, 418 423 offset_in_page(vec.paddr)); 419 424 segments++;
+3 -3
drivers/dma-buf/dma-buf-mapping.c
··· 33 33 } 34 34 35 35 static unsigned int calc_sg_nents(struct dma_iova_state *state, 36 - struct dma_buf_phys_vec *phys_vec, 37 - size_t nr_ranges, size_t size) 36 + struct phys_vec *phys_vec, size_t nr_ranges, 37 + size_t size) 38 38 { 39 39 unsigned int nents = 0; 40 40 size_t i; ··· 91 91 */ 92 92 struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach, 93 93 struct p2pdma_provider *provider, 94 - struct dma_buf_phys_vec *phys_vec, 94 + struct phys_vec *phys_vec, 95 95 size_t nr_ranges, size_t size, 96 96 enum dma_data_direction dir) 97 97 {
+1 -1
drivers/iommu/iommufd/io_pagetable.h
··· 202 202 203 203 struct iopt_pages_dmabuf { 204 204 struct dma_buf_attachment *attach; 205 - struct dma_buf_phys_vec phys; 205 + struct phys_vec phys; 206 206 /* Always PAGE_SIZE aligned */ 207 207 unsigned long start; 208 208 struct list_head tracker;
+2 -3
drivers/iommu/iommufd/iommufd_private.h
··· 20 20 struct iommu_option; 21 21 struct iommufd_device; 22 22 struct dma_buf_attachment; 23 - struct dma_buf_phys_vec; 24 23 25 24 struct iommufd_sw_msi_map { 26 25 struct list_head sw_msi_item; ··· 717 718 void iommufd_test_exit(void); 718 719 bool iommufd_selftest_is_mock_dev(struct device *dev); 719 720 int iommufd_test_dma_buf_iommufd_map(struct dma_buf_attachment *attachment, 720 - struct dma_buf_phys_vec *phys); 721 + struct phys_vec *phys); 721 722 #else 722 723 static inline void iommufd_test_syz_conv_iova_id(struct iommufd_ucmd *ucmd, 723 724 unsigned int ioas_id, ··· 741 742 } 742 743 static inline int 743 744 iommufd_test_dma_buf_iommufd_map(struct dma_buf_attachment *attachment, 744 - struct dma_buf_phys_vec *phys) 745 + struct phys_vec *phys) 745 746 { 746 747 return -EOPNOTSUPP; 747 748 }
+2 -2
drivers/iommu/iommufd/pages.c
··· 1077 1077 } 1078 1078 1079 1079 struct pfn_reader_dmabuf { 1080 - struct dma_buf_phys_vec phys; 1080 + struct phys_vec phys; 1081 1081 unsigned long start_offset; 1082 1082 }; 1083 1083 ··· 1460 1460 */ 1461 1461 static int 1462 1462 sym_vfio_pci_dma_buf_iommufd_map(struct dma_buf_attachment *attachment, 1463 - struct dma_buf_phys_vec *phys) 1463 + struct phys_vec *phys) 1464 1464 { 1465 1465 typeof(&vfio_pci_dma_buf_iommufd_map) fn; 1466 1466 int rc;
+1 -1
drivers/iommu/iommufd/selftest.c
··· 2002 2002 }; 2003 2003 2004 2004 int iommufd_test_dma_buf_iommufd_map(struct dma_buf_attachment *attachment, 2005 - struct dma_buf_phys_vec *phys) 2005 + struct phys_vec *phys) 2006 2006 { 2007 2007 struct iommufd_test_dma_buf *priv = attachment->dmabuf->priv; 2008 2008
+2 -2
drivers/nvme/host/pci.c
··· 290 290 u8 flags; 291 291 u8 nr_descriptors; 292 292 293 - unsigned int total_len; 293 + size_t total_len; 294 294 struct dma_iova_state dma_state; 295 295 void *descriptors[NVME_MAX_NR_DESCRIPTORS]; 296 296 struct nvme_dma_vec *dma_vecs; 297 297 unsigned int nr_dma_vecs; 298 298 299 299 dma_addr_t meta_dma; 300 - unsigned int meta_total_len; 300 + size_t meta_total_len; 301 301 struct dma_iova_state meta_dma_state; 302 302 struct nvme_sgl_desc *meta_descriptor; 303 303 };
+1 -1
drivers/vfio/pci/nvgrace-gpu/main.c
··· 889 889 static int nvgrace_get_dmabuf_phys(struct vfio_pci_core_device *core_vdev, 890 890 struct p2pdma_provider **provider, 891 891 unsigned int region_index, 892 - struct dma_buf_phys_vec *phys_vec, 892 + struct phys_vec *phys_vec, 893 893 struct vfio_region_dma_range *dma_ranges, 894 894 size_t nr_ranges) 895 895 {
+4 -4
drivers/vfio/pci/vfio_pci_dmabuf.c
··· 14 14 struct vfio_pci_core_device *vdev; 15 15 struct list_head dmabufs_elm; 16 16 size_t size; 17 - struct dma_buf_phys_vec *phys_vec; 17 + struct phys_vec *phys_vec; 18 18 struct p2pdma_provider *provider; 19 19 u32 nr_ranges; 20 20 u8 revoked : 1; ··· 94 94 * will fail if it is currently revoked 95 95 */ 96 96 int vfio_pci_dma_buf_iommufd_map(struct dma_buf_attachment *attachment, 97 - struct dma_buf_phys_vec *phys) 97 + struct phys_vec *phys) 98 98 { 99 99 struct vfio_pci_dma_buf *priv; 100 100 ··· 116 116 } 117 117 EXPORT_SYMBOL_FOR_MODULES(vfio_pci_dma_buf_iommufd_map, "iommufd"); 118 118 119 - int vfio_pci_core_fill_phys_vec(struct dma_buf_phys_vec *phys_vec, 119 + int vfio_pci_core_fill_phys_vec(struct phys_vec *phys_vec, 120 120 struct vfio_region_dma_range *dma_ranges, 121 121 size_t nr_ranges, phys_addr_t start, 122 122 phys_addr_t len) ··· 148 148 int vfio_pci_core_get_dmabuf_phys(struct vfio_pci_core_device *vdev, 149 149 struct p2pdma_provider **provider, 150 150 unsigned int region_index, 151 - struct dma_buf_phys_vec *phys_vec, 151 + struct phys_vec *phys_vec, 152 152 struct vfio_region_dma_range *dma_ranges, 153 153 size_t nr_ranges) 154 154 {
+1 -1
include/linux/dma-buf-mapping.h
··· 9 9 10 10 struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach, 11 11 struct p2pdma_provider *provider, 12 - struct dma_buf_phys_vec *phys_vec, 12 + struct phys_vec *phys_vec, 13 13 size_t nr_ranges, size_t size, 14 14 enum dma_data_direction dir); 15 15 void dma_buf_free_sgt(struct dma_buf_attachment *attach, struct sg_table *sgt,
-10
include/linux/dma-buf.h
··· 532 532 }; 533 533 534 534 /** 535 - * struct dma_buf_phys_vec - describe continuous chunk of memory 536 - * @paddr: physical address of that chunk 537 - * @len: Length of this chunk 538 - */ 539 - struct dma_buf_phys_vec { 540 - phys_addr_t paddr; 541 - size_t len; 542 - }; 543 - 544 - /** 545 535 * DEFINE_DMA_BUF_EXPORT_INFO - helper macro for exporters 546 536 * @name: export-info name 547 537 *
+5
include/linux/types.h
··· 171 171 typedef u32 phys_addr_t; 172 172 #endif 173 173 174 + struct phys_vec { 175 + phys_addr_t paddr; 176 + size_t len; 177 + }; 178 + 174 179 typedef phys_addr_t resource_size_t; 175 180 176 181 /*
+6 -7
include/linux/vfio_pci_core.h
··· 28 28 struct vfio_pci_core_device; 29 29 struct vfio_pci_region; 30 30 struct p2pdma_provider; 31 - struct dma_buf_phys_vec; 32 31 struct dma_buf_attachment; 33 32 34 33 struct vfio_pci_eventfd { ··· 61 62 int (*get_dmabuf_phys)(struct vfio_pci_core_device *vdev, 62 63 struct p2pdma_provider **provider, 63 64 unsigned int region_index, 64 - struct dma_buf_phys_vec *phys_vec, 65 + struct phys_vec *phys_vec, 65 66 struct vfio_region_dma_range *dma_ranges, 66 67 size_t nr_ranges); 67 68 }; 68 69 69 70 #if IS_ENABLED(CONFIG_VFIO_PCI_DMABUF) 70 - int vfio_pci_core_fill_phys_vec(struct dma_buf_phys_vec *phys_vec, 71 + int vfio_pci_core_fill_phys_vec(struct phys_vec *phys_vec, 71 72 struct vfio_region_dma_range *dma_ranges, 72 73 size_t nr_ranges, phys_addr_t start, 73 74 phys_addr_t len); 74 75 int vfio_pci_core_get_dmabuf_phys(struct vfio_pci_core_device *vdev, 75 76 struct p2pdma_provider **provider, 76 77 unsigned int region_index, 77 - struct dma_buf_phys_vec *phys_vec, 78 + struct phys_vec *phys_vec, 78 79 struct vfio_region_dma_range *dma_ranges, 79 80 size_t nr_ranges); 80 81 #else 81 82 static inline int 82 - vfio_pci_core_fill_phys_vec(struct dma_buf_phys_vec *phys_vec, 83 + vfio_pci_core_fill_phys_vec(struct phys_vec *phys_vec, 83 84 struct vfio_region_dma_range *dma_ranges, 84 85 size_t nr_ranges, phys_addr_t start, 85 86 phys_addr_t len) ··· 88 89 } 89 90 static inline int vfio_pci_core_get_dmabuf_phys( 90 91 struct vfio_pci_core_device *vdev, struct p2pdma_provider **provider, 91 - unsigned int region_index, struct dma_buf_phys_vec *phys_vec, 92 + unsigned int region_index, struct phys_vec *phys_vec, 92 93 struct vfio_region_dma_range *dma_ranges, size_t nr_ranges) 93 94 { 94 95 return -EOPNOTSUPP; ··· 235 236 } 236 237 237 238 int vfio_pci_dma_buf_iommufd_map(struct dma_buf_attachment *attachment, 238 - struct dma_buf_phys_vec *phys); 239 + struct phys_vec *phys); 239 240 240 241 #endif /* VFIO_PCI_CORE_H */