Lines Matching refs:perm

112 			  struct perm_bits *perm, int offset, __le32 *val);
114 struct perm_bits *perm, int offset, __le32 val);
175 int count, struct perm_bits *perm, in vfio_default_config_read() argument
182 memcpy(&virt, perm->virt + offset, count); in vfio_default_config_read()
201 int count, struct perm_bits *perm, in vfio_default_config_write() argument
206 memcpy(&write, perm->write + offset, count); in vfio_default_config_write()
211 memcpy(&virt, perm->virt + offset, count); in vfio_default_config_write()
248 int count, struct perm_bits *perm, in vfio_direct_config_read() argument
273 int count, struct perm_bits *perm, in vfio_raw_config_write() argument
286 int count, struct perm_bits *perm, in vfio_raw_config_read() argument
300 int count, struct perm_bits *perm, in vfio_virt_config_write() argument
308 int count, struct perm_bits *perm, in vfio_virt_config_read() argument
338 static void free_perm_bits(struct perm_bits *perm) in free_perm_bits() argument
340 kfree(perm->virt); in free_perm_bits()
341 kfree(perm->write); in free_perm_bits()
342 perm->virt = NULL; in free_perm_bits()
343 perm->write = NULL; in free_perm_bits()
346 static int alloc_perm_bits(struct perm_bits *perm, int size) in alloc_perm_bits() argument
362 perm->virt = kzalloc(size, GFP_KERNEL); in alloc_perm_bits()
363 perm->write = kzalloc(size, GFP_KERNEL); in alloc_perm_bits()
364 if (!perm->virt || !perm->write) { in alloc_perm_bits()
365 free_perm_bits(perm); in alloc_perm_bits()
369 perm->readfn = vfio_default_config_read; in alloc_perm_bits()
370 perm->writefn = vfio_default_config_write; in alloc_perm_bits()
518 int count, struct perm_bits *perm, in vfio_basic_config_read() argument
524 count = vfio_default_config_read(vdev, pos, count, perm, offset, val); in vfio_basic_config_read()
556 int count, struct perm_bits *perm, in vfio_basic_config_write() argument
605 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_basic_config_write()
648 static int __init init_pci_cap_basic_perm(struct perm_bits *perm) in init_pci_cap_basic_perm() argument
650 if (alloc_perm_bits(perm, PCI_STD_HEADER_SIZEOF)) in init_pci_cap_basic_perm()
653 perm->readfn = vfio_basic_config_read; in init_pci_cap_basic_perm()
654 perm->writefn = vfio_basic_config_write; in init_pci_cap_basic_perm()
657 p_setw(perm, PCI_VENDOR_ID, (u16)ALL_VIRT, NO_WRITE); in init_pci_cap_basic_perm()
658 p_setw(perm, PCI_DEVICE_ID, (u16)ALL_VIRT, NO_WRITE); in init_pci_cap_basic_perm()
664 p_setw(perm, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE, (u16)ALL_WRITE); in init_pci_cap_basic_perm()
667 p_setw(perm, PCI_STATUS, PCI_STATUS_CAP_LIST, NO_WRITE); in init_pci_cap_basic_perm()
670 p_setb(perm, PCI_CACHE_LINE_SIZE, NO_VIRT, (u8)ALL_WRITE); in init_pci_cap_basic_perm()
671 p_setb(perm, PCI_LATENCY_TIMER, NO_VIRT, (u8)ALL_WRITE); in init_pci_cap_basic_perm()
672 p_setb(perm, PCI_BIST, NO_VIRT, (u8)ALL_WRITE); in init_pci_cap_basic_perm()
675 p_setd(perm, PCI_BASE_ADDRESS_0, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
676 p_setd(perm, PCI_BASE_ADDRESS_1, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
677 p_setd(perm, PCI_BASE_ADDRESS_2, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
678 p_setd(perm, PCI_BASE_ADDRESS_3, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
679 p_setd(perm, PCI_BASE_ADDRESS_4, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
680 p_setd(perm, PCI_BASE_ADDRESS_5, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
681 p_setd(perm, PCI_ROM_ADDRESS, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
684 p_setb(perm, PCI_CAPABILITY_LIST, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_basic_perm()
687 p_setb(perm, PCI_INTERRUPT_LINE, (u8)ALL_VIRT, (u8)ALL_WRITE); in init_pci_cap_basic_perm()
690 p_setb(perm, PCI_INTERRUPT_PIN, (u8)ALL_VIRT, (u8)NO_WRITE); in init_pci_cap_basic_perm()
696 int count, struct perm_bits *perm, in vfio_pm_config_write() argument
699 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_pm_config_write()
728 static int __init init_pci_cap_pm_perm(struct perm_bits *perm) in init_pci_cap_pm_perm() argument
730 if (alloc_perm_bits(perm, pci_cap_length[PCI_CAP_ID_PM])) in init_pci_cap_pm_perm()
733 perm->writefn = vfio_pm_config_write; in init_pci_cap_pm_perm()
739 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_pm_perm()
746 p_setd(perm, PCI_PM_CTRL, NO_VIRT, ~PCI_PM_CTRL_STATE_MASK); in init_pci_cap_pm_perm()
751 int count, struct perm_bits *perm, in vfio_vpd_config_write() argument
765 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_vpd_config_write()
795 static int __init init_pci_cap_vpd_perm(struct perm_bits *perm) in init_pci_cap_vpd_perm() argument
797 if (alloc_perm_bits(perm, pci_cap_length[PCI_CAP_ID_VPD])) in init_pci_cap_vpd_perm()
800 perm->writefn = vfio_vpd_config_write; in init_pci_cap_vpd_perm()
806 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_vpd_perm()
812 p_setw(perm, PCI_VPD_ADDR, (u16)ALL_VIRT, (u16)ALL_WRITE); in init_pci_cap_vpd_perm()
813 p_setd(perm, PCI_VPD_DATA, ALL_VIRT, ALL_WRITE); in init_pci_cap_vpd_perm()
819 static int __init init_pci_cap_pcix_perm(struct perm_bits *perm) in init_pci_cap_pcix_perm() argument
822 if (alloc_perm_bits(perm, PCI_CAP_PCIX_SIZEOF_V2)) in init_pci_cap_pcix_perm()
825 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_pcix_perm()
827 p_setw(perm, PCI_X_CMD, NO_VIRT, (u16)ALL_WRITE); in init_pci_cap_pcix_perm()
828 p_setd(perm, PCI_X_ECC_CSR, NO_VIRT, ALL_WRITE); in init_pci_cap_pcix_perm()
833 int count, struct perm_bits *perm, in vfio_exp_config_write() argument
840 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_exp_config_write()
892 static int __init init_pci_cap_exp_perm(struct perm_bits *perm) in init_pci_cap_exp_perm() argument
895 if (alloc_perm_bits(perm, PCI_CAP_EXP_ENDPOINT_SIZEOF_V2)) in init_pci_cap_exp_perm()
898 perm->writefn = vfio_exp_config_write; in init_pci_cap_exp_perm()
900 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_exp_perm()
909 p_setw(perm, PCI_EXP_DEVCTL, in init_pci_cap_exp_perm()
912 p_setw(perm, PCI_EXP_DEVCTL2, NO_VIRT, ~PCI_EXP_DEVCTL2_ARI); in init_pci_cap_exp_perm()
917 int count, struct perm_bits *perm, in vfio_af_config_write() argument
922 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_af_config_write()
953 static int __init init_pci_cap_af_perm(struct perm_bits *perm) in init_pci_cap_af_perm() argument
955 if (alloc_perm_bits(perm, pci_cap_length[PCI_CAP_ID_AF])) in init_pci_cap_af_perm()
958 perm->writefn = vfio_af_config_write; in init_pci_cap_af_perm()
960 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_af_perm()
961 p_setb(perm, PCI_AF_CTRL, PCI_AF_CTRL_FLR, PCI_AF_CTRL_FLR); in init_pci_cap_af_perm()
966 static int __init init_pci_ext_cap_err_perm(struct perm_bits *perm) in init_pci_ext_cap_err_perm() argument
970 if (alloc_perm_bits(perm, pci_ext_cap_length[PCI_EXT_CAP_ID_ERR])) in init_pci_ext_cap_err_perm()
978 p_setd(perm, 0, ALL_VIRT, NO_WRITE); in init_pci_ext_cap_err_perm()
998 p_setd(perm, PCI_ERR_UNCOR_STATUS, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
999 p_setd(perm, PCI_ERR_UNCOR_MASK, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1000 p_setd(perm, PCI_ERR_UNCOR_SEVER, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1010 p_setd(perm, PCI_ERR_COR_STATUS, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1011 p_setd(perm, PCI_ERR_COR_MASK, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1015 p_setd(perm, PCI_ERR_CAP, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1020 static int __init init_pci_ext_cap_pwr_perm(struct perm_bits *perm) in init_pci_ext_cap_pwr_perm() argument
1022 if (alloc_perm_bits(perm, pci_ext_cap_length[PCI_EXT_CAP_ID_PWR])) in init_pci_ext_cap_pwr_perm()
1025 p_setd(perm, 0, ALL_VIRT, NO_WRITE); in init_pci_ext_cap_pwr_perm()
1028 p_setb(perm, PCI_PWR_DATA, NO_VIRT, (u8)ALL_WRITE); in init_pci_ext_cap_pwr_perm()
1093 int count, struct perm_bits *perm, in vfio_msi_config_read() argument
1109 return vfio_default_config_read(vdev, pos, count, perm, offset, val); in vfio_msi_config_read()
1113 int count, struct perm_bits *perm, in vfio_msi_config_write() argument
1116 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_msi_config_write()
1158 static int init_pci_cap_msi_perm(struct perm_bits *perm, int len, u16 flags) in init_pci_cap_msi_perm() argument
1160 if (alloc_perm_bits(perm, len)) in init_pci_cap_msi_perm()
1163 perm->readfn = vfio_msi_config_read; in init_pci_cap_msi_perm()
1164 perm->writefn = vfio_msi_config_write; in init_pci_cap_msi_perm()
1166 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_msi_perm()
1172 p_setb(perm, PCI_MSI_FLAGS, (u8)ALL_VIRT, (u8)ALL_WRITE); in init_pci_cap_msi_perm()
1173 p_setd(perm, PCI_MSI_ADDRESS_LO, ALL_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1175 p_setd(perm, PCI_MSI_ADDRESS_HI, ALL_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1176 p_setw(perm, PCI_MSI_DATA_64, (u16)ALL_VIRT, (u16)ALL_WRITE); in init_pci_cap_msi_perm()
1178 p_setd(perm, PCI_MSI_MASK_64, NO_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1179 p_setd(perm, PCI_MSI_PENDING_64, NO_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1182 p_setw(perm, PCI_MSI_DATA_32, (u16)ALL_VIRT, (u16)ALL_WRITE); in init_pci_cap_msi_perm()
1184 p_setd(perm, PCI_MSI_MASK_32, NO_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1185 p_setd(perm, PCI_MSI_PENDING_32, NO_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1809 struct perm_bits *perm; in vfio_config_do_rw() local
1836 perm = &unassigned_perms; in vfio_config_do_rw()
1839 perm = &virt_perms; in vfio_config_do_rw()
1845 perm = &ecap_perms[cap_id]; in vfio_config_do_rw()
1850 perm = &cap_perms[cap_id]; in vfio_config_do_rw()
1853 perm = vdev->msi_perm; in vfio_config_do_rw()
1866 if (!perm->writefn) in vfio_config_do_rw()
1872 ret = perm->writefn(vdev, *ppos, count, perm, offset, val); in vfio_config_do_rw()
1874 if (perm->readfn) { in vfio_config_do_rw()
1875 ret = perm->readfn(vdev, *ppos, count, in vfio_config_do_rw()
1876 perm, offset, &val); in vfio_config_do_rw()