3838#define vfio_iowrite8 iowrite8
3939
4040#define VFIO_IOWRITE (size ) \
41- static int vfio_pci_iowrite ##size(struct vfio_pci_core_device *vdev, \
41+ int vfio_pci_core_iowrite ##size(struct vfio_pci_core_device *vdev, \
4242 bool test_mem, u##size val, void __iomem *io) \
4343{ \
4444 if (test_mem) { \
@@ -55,7 +55,8 @@ static int vfio_pci_iowrite##size(struct vfio_pci_core_device *vdev, \
5555 up_read(&vdev->memory_lock); \
5656 \
5757 return 0; \
58- }
58+ } \
59+ EXPORT_SYMBOL_GPL(vfio_pci_core_iowrite##size);
5960
6061VFIO_IOWRITE (8 )
6162VFIO_IOWRITE (16 )
@@ -65,7 +66,7 @@ VFIO_IOWRITE(64)
6566#endif
6667
6768#define VFIO_IOREAD (size ) \
68- static int vfio_pci_ioread ##size(struct vfio_pci_core_device *vdev, \
69+ int vfio_pci_core_ioread ##size(struct vfio_pci_core_device *vdev, \
6970 bool test_mem, u##size *val, void __iomem *io) \
7071{ \
7172 if (test_mem) { \
@@ -82,7 +83,8 @@ static int vfio_pci_ioread##size(struct vfio_pci_core_device *vdev, \
8283 up_read(&vdev->memory_lock); \
8384 \
8485 return 0; \
85- }
86+ } \
87+ EXPORT_SYMBOL_GPL(vfio_pci_core_ioread##size);
8688
8789VFIO_IOREAD (8 )
8890VFIO_IOREAD (16 )
@@ -119,13 +121,13 @@ static ssize_t do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem,
119121 if (copy_from_user (& val , buf , 4 ))
120122 return - EFAULT ;
121123
122- ret = vfio_pci_iowrite32 (vdev , test_mem ,
123- val , io + off );
124+ ret = vfio_pci_core_iowrite32 (vdev , test_mem ,
125+ val , io + off );
124126 if (ret )
125127 return ret ;
126128 } else {
127- ret = vfio_pci_ioread32 (vdev , test_mem ,
128- & val , io + off );
129+ ret = vfio_pci_core_ioread32 (vdev , test_mem ,
130+ & val , io + off );
129131 if (ret )
130132 return ret ;
131133
@@ -141,13 +143,13 @@ static ssize_t do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem,
141143 if (copy_from_user (& val , buf , 2 ))
142144 return - EFAULT ;
143145
144- ret = vfio_pci_iowrite16 (vdev , test_mem ,
145- val , io + off );
146+ ret = vfio_pci_core_iowrite16 (vdev , test_mem ,
147+ val , io + off );
146148 if (ret )
147149 return ret ;
148150 } else {
149- ret = vfio_pci_ioread16 (vdev , test_mem ,
150- & val , io + off );
151+ ret = vfio_pci_core_ioread16 (vdev , test_mem ,
152+ & val , io + off );
151153 if (ret )
152154 return ret ;
153155
@@ -163,13 +165,13 @@ static ssize_t do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem,
163165 if (copy_from_user (& val , buf , 1 ))
164166 return - EFAULT ;
165167
166- ret = vfio_pci_iowrite8 (vdev , test_mem ,
167- val , io + off );
168+ ret = vfio_pci_core_iowrite8 (vdev , test_mem ,
169+ val , io + off );
168170 if (ret )
169171 return ret ;
170172 } else {
171- ret = vfio_pci_ioread8 (vdev , test_mem ,
172- & val , io + off );
173+ ret = vfio_pci_core_ioread8 (vdev , test_mem ,
174+ & val , io + off );
173175 if (ret )
174176 return ret ;
175177
@@ -200,7 +202,7 @@ static ssize_t do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem,
200202 return done ;
201203}
202204
203- static int vfio_pci_setup_barmap (struct vfio_pci_core_device * vdev , int bar )
205+ int vfio_pci_core_setup_barmap (struct vfio_pci_core_device * vdev , int bar )
204206{
205207 struct pci_dev * pdev = vdev -> pdev ;
206208 int ret ;
@@ -223,6 +225,7 @@ static int vfio_pci_setup_barmap(struct vfio_pci_core_device *vdev, int bar)
223225
224226 return 0 ;
225227}
228+ EXPORT_SYMBOL_GPL (vfio_pci_core_setup_barmap );
226229
227230ssize_t vfio_pci_bar_rw (struct vfio_pci_core_device * vdev , char __user * buf ,
228231 size_t count , loff_t * ppos , bool iswrite )
@@ -262,7 +265,7 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
262265 }
263266 x_end = end ;
264267 } else {
265- int ret = vfio_pci_setup_barmap (vdev , bar );
268+ int ret = vfio_pci_core_setup_barmap (vdev , bar );
266269 if (ret ) {
267270 done = ret ;
268271 goto out ;
@@ -363,21 +366,21 @@ static void vfio_pci_ioeventfd_do_write(struct vfio_pci_ioeventfd *ioeventfd,
363366{
364367 switch (ioeventfd -> count ) {
365368 case 1 :
366- vfio_pci_iowrite8 (ioeventfd -> vdev , test_mem ,
367- ioeventfd -> data , ioeventfd -> addr );
369+ vfio_pci_core_iowrite8 (ioeventfd -> vdev , test_mem ,
370+ ioeventfd -> data , ioeventfd -> addr );
368371 break ;
369372 case 2 :
370- vfio_pci_iowrite16 (ioeventfd -> vdev , test_mem ,
371- ioeventfd -> data , ioeventfd -> addr );
373+ vfio_pci_core_iowrite16 (ioeventfd -> vdev , test_mem ,
374+ ioeventfd -> data , ioeventfd -> addr );
372375 break ;
373376 case 4 :
374- vfio_pci_iowrite32 (ioeventfd -> vdev , test_mem ,
375- ioeventfd -> data , ioeventfd -> addr );
377+ vfio_pci_core_iowrite32 (ioeventfd -> vdev , test_mem ,
378+ ioeventfd -> data , ioeventfd -> addr );
376379 break ;
377380#ifdef iowrite64
378381 case 8 :
379- vfio_pci_iowrite64 (ioeventfd -> vdev , test_mem ,
380- ioeventfd -> data , ioeventfd -> addr );
382+ vfio_pci_core_iowrite64 (ioeventfd -> vdev , test_mem ,
383+ ioeventfd -> data , ioeventfd -> addr );
381384 break ;
382385#endif
383386 }
@@ -438,7 +441,7 @@ int vfio_pci_ioeventfd(struct vfio_pci_core_device *vdev, loff_t offset,
438441 return - EINVAL ;
439442#endif
440443
441- ret = vfio_pci_setup_barmap (vdev , bar );
444+ ret = vfio_pci_core_setup_barmap (vdev , bar );
442445 if (ret )
443446 return ret ;
444447
0 commit comments