@@ -108,9 +108,9 @@ static const u16 pci_ext_cap_length[PCI_EXT_CAP_ID_MAX + 1] = {
108108struct perm_bits {
109109 u8 * virt ; /* read/write virtual data, not hw */
110110 u8 * write ; /* writeable bits */
111- int (* readfn )(struct vfio_pci_device * vdev , int pos , int count ,
111+ int (* readfn )(struct vfio_pci_core_device * vdev , int pos , int count ,
112112 struct perm_bits * perm , int offset , __le32 * val );
113- int (* writefn )(struct vfio_pci_device * vdev , int pos , int count ,
113+ int (* writefn )(struct vfio_pci_core_device * vdev , int pos , int count ,
114114 struct perm_bits * perm , int offset , __le32 val );
115115};
116116
@@ -171,7 +171,7 @@ static int vfio_user_config_write(struct pci_dev *pdev, int offset,
171171 return ret ;
172172}
173173
174- static int vfio_default_config_read (struct vfio_pci_device * vdev , int pos ,
174+ static int vfio_default_config_read (struct vfio_pci_core_device * vdev , int pos ,
175175 int count , struct perm_bits * perm ,
176176 int offset , __le32 * val )
177177{
@@ -197,7 +197,7 @@ static int vfio_default_config_read(struct vfio_pci_device *vdev, int pos,
197197 return count ;
198198}
199199
200- static int vfio_default_config_write (struct vfio_pci_device * vdev , int pos ,
200+ static int vfio_default_config_write (struct vfio_pci_core_device * vdev , int pos ,
201201 int count , struct perm_bits * perm ,
202202 int offset , __le32 val )
203203{
@@ -244,7 +244,7 @@ static int vfio_default_config_write(struct vfio_pci_device *vdev, int pos,
244244}
245245
246246/* Allow direct read from hardware, except for capability next pointer */
247- static int vfio_direct_config_read (struct vfio_pci_device * vdev , int pos ,
247+ static int vfio_direct_config_read (struct vfio_pci_core_device * vdev , int pos ,
248248 int count , struct perm_bits * perm ,
249249 int offset , __le32 * val )
250250{
@@ -269,7 +269,7 @@ static int vfio_direct_config_read(struct vfio_pci_device *vdev, int pos,
269269}
270270
271271/* Raw access skips any kind of virtualization */
272- static int vfio_raw_config_write (struct vfio_pci_device * vdev , int pos ,
272+ static int vfio_raw_config_write (struct vfio_pci_core_device * vdev , int pos ,
273273 int count , struct perm_bits * perm ,
274274 int offset , __le32 val )
275275{
@@ -282,7 +282,7 @@ static int vfio_raw_config_write(struct vfio_pci_device *vdev, int pos,
282282 return count ;
283283}
284284
285- static int vfio_raw_config_read (struct vfio_pci_device * vdev , int pos ,
285+ static int vfio_raw_config_read (struct vfio_pci_core_device * vdev , int pos ,
286286 int count , struct perm_bits * perm ,
287287 int offset , __le32 * val )
288288{
@@ -296,15 +296,15 @@ static int vfio_raw_config_read(struct vfio_pci_device *vdev, int pos,
296296}
297297
298298/* Virt access uses only virtualization */
299- static int vfio_virt_config_write (struct vfio_pci_device * vdev , int pos ,
299+ static int vfio_virt_config_write (struct vfio_pci_core_device * vdev , int pos ,
300300 int count , struct perm_bits * perm ,
301301 int offset , __le32 val )
302302{
303303 memcpy (vdev -> vconfig + pos , & val , count );
304304 return count ;
305305}
306306
307- static int vfio_virt_config_read (struct vfio_pci_device * vdev , int pos ,
307+ static int vfio_virt_config_read (struct vfio_pci_core_device * vdev , int pos ,
308308 int count , struct perm_bits * perm ,
309309 int offset , __le32 * val )
310310{
@@ -396,7 +396,7 @@ static inline void p_setd(struct perm_bits *p, int off, u32 virt, u32 write)
396396}
397397
398398/* Caller should hold memory_lock semaphore */
399- bool __vfio_pci_memory_enabled (struct vfio_pci_device * vdev )
399+ bool __vfio_pci_memory_enabled (struct vfio_pci_core_device * vdev )
400400{
401401 struct pci_dev * pdev = vdev -> pdev ;
402402 u16 cmd = le16_to_cpu (* (__le16 * )& vdev -> vconfig [PCI_COMMAND ]);
@@ -413,7 +413,7 @@ bool __vfio_pci_memory_enabled(struct vfio_pci_device *vdev)
413413 * Restore the *real* BARs after we detect a FLR or backdoor reset.
414414 * (backdoor = some device specific technique that we didn't catch)
415415 */
416- static void vfio_bar_restore (struct vfio_pci_device * vdev )
416+ static void vfio_bar_restore (struct vfio_pci_core_device * vdev )
417417{
418418 struct pci_dev * pdev = vdev -> pdev ;
419419 u32 * rbar = vdev -> rbar ;
@@ -460,7 +460,7 @@ static __le32 vfio_generate_bar_flags(struct pci_dev *pdev, int bar)
460460 * Pretend we're hardware and tweak the values of the *virtual* PCI BARs
461461 * to reflect the hardware capabilities. This implements BAR sizing.
462462 */
463- static void vfio_bar_fixup (struct vfio_pci_device * vdev )
463+ static void vfio_bar_fixup (struct vfio_pci_core_device * vdev )
464464{
465465 struct pci_dev * pdev = vdev -> pdev ;
466466 int i ;
@@ -514,7 +514,7 @@ static void vfio_bar_fixup(struct vfio_pci_device *vdev)
514514 vdev -> bardirty = false;
515515}
516516
517- static int vfio_basic_config_read (struct vfio_pci_device * vdev , int pos ,
517+ static int vfio_basic_config_read (struct vfio_pci_core_device * vdev , int pos ,
518518 int count , struct perm_bits * perm ,
519519 int offset , __le32 * val )
520520{
@@ -536,7 +536,7 @@ static int vfio_basic_config_read(struct vfio_pci_device *vdev, int pos,
536536}
537537
538538/* Test whether BARs match the value we think they should contain */
539- static bool vfio_need_bar_restore (struct vfio_pci_device * vdev )
539+ static bool vfio_need_bar_restore (struct vfio_pci_core_device * vdev )
540540{
541541 int i = 0 , pos = PCI_BASE_ADDRESS_0 , ret ;
542542 u32 bar ;
@@ -552,7 +552,7 @@ static bool vfio_need_bar_restore(struct vfio_pci_device *vdev)
552552 return false;
553553}
554554
555- static int vfio_basic_config_write (struct vfio_pci_device * vdev , int pos ,
555+ static int vfio_basic_config_write (struct vfio_pci_core_device * vdev , int pos ,
556556 int count , struct perm_bits * perm ,
557557 int offset , __le32 val )
558558{
@@ -692,7 +692,7 @@ static int __init init_pci_cap_basic_perm(struct perm_bits *perm)
692692 return 0 ;
693693}
694694
695- static int vfio_pm_config_write (struct vfio_pci_device * vdev , int pos ,
695+ static int vfio_pm_config_write (struct vfio_pci_core_device * vdev , int pos ,
696696 int count , struct perm_bits * perm ,
697697 int offset , __le32 val )
698698{
@@ -747,7 +747,7 @@ static int __init init_pci_cap_pm_perm(struct perm_bits *perm)
747747 return 0 ;
748748}
749749
750- static int vfio_vpd_config_write (struct vfio_pci_device * vdev , int pos ,
750+ static int vfio_vpd_config_write (struct vfio_pci_core_device * vdev , int pos ,
751751 int count , struct perm_bits * perm ,
752752 int offset , __le32 val )
753753{
@@ -829,7 +829,7 @@ static int __init init_pci_cap_pcix_perm(struct perm_bits *perm)
829829 return 0 ;
830830}
831831
832- static int vfio_exp_config_write (struct vfio_pci_device * vdev , int pos ,
832+ static int vfio_exp_config_write (struct vfio_pci_core_device * vdev , int pos ,
833833 int count , struct perm_bits * perm ,
834834 int offset , __le32 val )
835835{
@@ -913,7 +913,7 @@ static int __init init_pci_cap_exp_perm(struct perm_bits *perm)
913913 return 0 ;
914914}
915915
916- static int vfio_af_config_write (struct vfio_pci_device * vdev , int pos ,
916+ static int vfio_af_config_write (struct vfio_pci_core_device * vdev , int pos ,
917917 int count , struct perm_bits * perm ,
918918 int offset , __le32 val )
919919{
@@ -1072,7 +1072,7 @@ int __init vfio_pci_init_perm_bits(void)
10721072 return ret ;
10731073}
10741074
1075- static int vfio_find_cap_start (struct vfio_pci_device * vdev , int pos )
1075+ static int vfio_find_cap_start (struct vfio_pci_core_device * vdev , int pos )
10761076{
10771077 u8 cap ;
10781078 int base = (pos >= PCI_CFG_SPACE_SIZE ) ? PCI_CFG_SPACE_SIZE :
@@ -1089,7 +1089,7 @@ static int vfio_find_cap_start(struct vfio_pci_device *vdev, int pos)
10891089 return pos ;
10901090}
10911091
1092- static int vfio_msi_config_read (struct vfio_pci_device * vdev , int pos ,
1092+ static int vfio_msi_config_read (struct vfio_pci_core_device * vdev , int pos ,
10931093 int count , struct perm_bits * perm ,
10941094 int offset , __le32 * val )
10951095{
@@ -1109,7 +1109,7 @@ static int vfio_msi_config_read(struct vfio_pci_device *vdev, int pos,
11091109 return vfio_default_config_read (vdev , pos , count , perm , offset , val );
11101110}
11111111
1112- static int vfio_msi_config_write (struct vfio_pci_device * vdev , int pos ,
1112+ static int vfio_msi_config_write (struct vfio_pci_core_device * vdev , int pos ,
11131113 int count , struct perm_bits * perm ,
11141114 int offset , __le32 val )
11151115{
@@ -1189,7 +1189,7 @@ static int init_pci_cap_msi_perm(struct perm_bits *perm, int len, u16 flags)
11891189}
11901190
11911191/* Determine MSI CAP field length; initialize msi_perms on 1st call per vdev */
1192- static int vfio_msi_cap_len (struct vfio_pci_device * vdev , u8 pos )
1192+ static int vfio_msi_cap_len (struct vfio_pci_core_device * vdev , u8 pos )
11931193{
11941194 struct pci_dev * pdev = vdev -> pdev ;
11951195 int len , ret ;
@@ -1222,7 +1222,7 @@ static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos)
12221222}
12231223
12241224/* Determine extended capability length for VC (2 & 9) and MFVC */
1225- static int vfio_vc_cap_len (struct vfio_pci_device * vdev , u16 pos )
1225+ static int vfio_vc_cap_len (struct vfio_pci_core_device * vdev , u16 pos )
12261226{
12271227 struct pci_dev * pdev = vdev -> pdev ;
12281228 u32 tmp ;
@@ -1263,7 +1263,7 @@ static int vfio_vc_cap_len(struct vfio_pci_device *vdev, u16 pos)
12631263 return len ;
12641264}
12651265
1266- static int vfio_cap_len (struct vfio_pci_device * vdev , u8 cap , u8 pos )
1266+ static int vfio_cap_len (struct vfio_pci_core_device * vdev , u8 cap , u8 pos )
12671267{
12681268 struct pci_dev * pdev = vdev -> pdev ;
12691269 u32 dword ;
@@ -1338,7 +1338,7 @@ static int vfio_cap_len(struct vfio_pci_device *vdev, u8 cap, u8 pos)
13381338 return 0 ;
13391339}
13401340
1341- static int vfio_ext_cap_len (struct vfio_pci_device * vdev , u16 ecap , u16 epos )
1341+ static int vfio_ext_cap_len (struct vfio_pci_core_device * vdev , u16 ecap , u16 epos )
13421342{
13431343 struct pci_dev * pdev = vdev -> pdev ;
13441344 u8 byte ;
@@ -1412,7 +1412,7 @@ static int vfio_ext_cap_len(struct vfio_pci_device *vdev, u16 ecap, u16 epos)
14121412 return 0 ;
14131413}
14141414
1415- static int vfio_fill_vconfig_bytes (struct vfio_pci_device * vdev ,
1415+ static int vfio_fill_vconfig_bytes (struct vfio_pci_core_device * vdev ,
14161416 int offset , int size )
14171417{
14181418 struct pci_dev * pdev = vdev -> pdev ;
@@ -1459,7 +1459,7 @@ static int vfio_fill_vconfig_bytes(struct vfio_pci_device *vdev,
14591459 return ret ;
14601460}
14611461
1462- static int vfio_cap_init (struct vfio_pci_device * vdev )
1462+ static int vfio_cap_init (struct vfio_pci_core_device * vdev )
14631463{
14641464 struct pci_dev * pdev = vdev -> pdev ;
14651465 u8 * map = vdev -> pci_config_map ;
@@ -1549,7 +1549,7 @@ static int vfio_cap_init(struct vfio_pci_device *vdev)
15491549 return 0 ;
15501550}
15511551
1552- static int vfio_ecap_init (struct vfio_pci_device * vdev )
1552+ static int vfio_ecap_init (struct vfio_pci_core_device * vdev )
15531553{
15541554 struct pci_dev * pdev = vdev -> pdev ;
15551555 u8 * map = vdev -> pci_config_map ;
@@ -1669,7 +1669,7 @@ static const struct pci_device_id known_bogus_vf_intx_pin[] = {
16691669 * for each area requiring emulated bits, but the array of pointers
16701670 * would be comparable in size (at least for standard config space).
16711671 */
1672- int vfio_config_init (struct vfio_pci_device * vdev )
1672+ int vfio_config_init (struct vfio_pci_core_device * vdev )
16731673{
16741674 struct pci_dev * pdev = vdev -> pdev ;
16751675 u8 * map , * vconfig ;
@@ -1773,7 +1773,7 @@ int vfio_config_init(struct vfio_pci_device *vdev)
17731773 return pcibios_err_to_errno (ret );
17741774}
17751775
1776- void vfio_config_free (struct vfio_pci_device * vdev )
1776+ void vfio_config_free (struct vfio_pci_core_device * vdev )
17771777{
17781778 kfree (vdev -> vconfig );
17791779 vdev -> vconfig = NULL ;
@@ -1790,7 +1790,7 @@ void vfio_config_free(struct vfio_pci_device *vdev)
17901790 * Find the remaining number of bytes in a dword that match the given
17911791 * position. Stop at either the end of the capability or the dword boundary.
17921792 */
1793- static size_t vfio_pci_cap_remaining_dword (struct vfio_pci_device * vdev ,
1793+ static size_t vfio_pci_cap_remaining_dword (struct vfio_pci_core_device * vdev ,
17941794 loff_t pos )
17951795{
17961796 u8 cap = vdev -> pci_config_map [pos ];
@@ -1802,7 +1802,7 @@ static size_t vfio_pci_cap_remaining_dword(struct vfio_pci_device *vdev,
18021802 return i ;
18031803}
18041804
1805- static ssize_t vfio_config_do_rw (struct vfio_pci_device * vdev , char __user * buf ,
1805+ static ssize_t vfio_config_do_rw (struct vfio_pci_core_device * vdev , char __user * buf ,
18061806 size_t count , loff_t * ppos , bool iswrite )
18071807{
18081808 struct pci_dev * pdev = vdev -> pdev ;
@@ -1885,7 +1885,7 @@ static ssize_t vfio_config_do_rw(struct vfio_pci_device *vdev, char __user *buf,
18851885 return ret ;
18861886}
18871887
1888- ssize_t vfio_pci_config_rw (struct vfio_pci_device * vdev , char __user * buf ,
1888+ ssize_t vfio_pci_config_rw (struct vfio_pci_core_device * vdev , char __user * buf ,
18891889 size_t count , loff_t * ppos , bool iswrite )
18901890{
18911891 size_t done = 0 ;
0 commit comments