Lines Matching refs:perm
113 struct perm_bits *perm, int offset, __le32 *val);
115 struct perm_bits *perm, int offset, __le32 val);
176 int count, struct perm_bits *perm, in vfio_default_config_read() argument
183 memcpy(&virt, perm->virt + offset, count); in vfio_default_config_read()
202 int count, struct perm_bits *perm, in vfio_default_config_write() argument
207 memcpy(&write, perm->write + offset, count); in vfio_default_config_write()
212 memcpy(&virt, perm->virt + offset, count); in vfio_default_config_write()
249 int count, struct perm_bits *perm, in vfio_direct_config_read() argument
274 int count, struct perm_bits *perm, in vfio_raw_config_write() argument
287 int count, struct perm_bits *perm, in vfio_raw_config_read() argument
301 int count, struct perm_bits *perm, in vfio_virt_config_write() argument
309 int count, struct perm_bits *perm, in vfio_virt_config_read() argument
339 static void free_perm_bits(struct perm_bits *perm) in free_perm_bits() argument
341 kfree(perm->virt); in free_perm_bits()
342 kfree(perm->write); in free_perm_bits()
343 perm->virt = NULL; in free_perm_bits()
344 perm->write = NULL; in free_perm_bits()
347 static int alloc_perm_bits(struct perm_bits *perm, int size) in alloc_perm_bits() argument
363 perm->virt = kzalloc(size, GFP_KERNEL); in alloc_perm_bits()
364 perm->write = kzalloc(size, GFP_KERNEL); in alloc_perm_bits()
365 if (!perm->virt || !perm->write) { in alloc_perm_bits()
366 free_perm_bits(perm); in alloc_perm_bits()
370 perm->readfn = vfio_default_config_read; in alloc_perm_bits()
371 perm->writefn = vfio_default_config_write; in alloc_perm_bits()
522 int count, struct perm_bits *perm, in vfio_basic_config_read() argument
528 count = vfio_default_config_read(vdev, pos, count, perm, offset, val); in vfio_basic_config_read()
560 int count, struct perm_bits *perm, in vfio_basic_config_write() argument
609 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_basic_config_write()
652 static int __init init_pci_cap_basic_perm(struct perm_bits *perm) in init_pci_cap_basic_perm() argument
654 if (alloc_perm_bits(perm, PCI_STD_HEADER_SIZEOF)) in init_pci_cap_basic_perm()
657 perm->readfn = vfio_basic_config_read; in init_pci_cap_basic_perm()
658 perm->writefn = vfio_basic_config_write; in init_pci_cap_basic_perm()
661 p_setw(perm, PCI_VENDOR_ID, (u16)ALL_VIRT, NO_WRITE); in init_pci_cap_basic_perm()
662 p_setw(perm, PCI_DEVICE_ID, (u16)ALL_VIRT, NO_WRITE); in init_pci_cap_basic_perm()
668 p_setw(perm, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE, (u16)ALL_WRITE); in init_pci_cap_basic_perm()
671 p_setw(perm, PCI_STATUS, PCI_STATUS_CAP_LIST, NO_WRITE); in init_pci_cap_basic_perm()
674 p_setb(perm, PCI_CACHE_LINE_SIZE, NO_VIRT, (u8)ALL_WRITE); in init_pci_cap_basic_perm()
675 p_setb(perm, PCI_LATENCY_TIMER, NO_VIRT, (u8)ALL_WRITE); in init_pci_cap_basic_perm()
676 p_setb(perm, PCI_BIST, NO_VIRT, (u8)ALL_WRITE); in init_pci_cap_basic_perm()
679 p_setd(perm, PCI_BASE_ADDRESS_0, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
680 p_setd(perm, PCI_BASE_ADDRESS_1, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
681 p_setd(perm, PCI_BASE_ADDRESS_2, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
682 p_setd(perm, PCI_BASE_ADDRESS_3, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
683 p_setd(perm, PCI_BASE_ADDRESS_4, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
684 p_setd(perm, PCI_BASE_ADDRESS_5, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
685 p_setd(perm, PCI_ROM_ADDRESS, ALL_VIRT, ALL_WRITE); in init_pci_cap_basic_perm()
688 p_setb(perm, PCI_CAPABILITY_LIST, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_basic_perm()
691 p_setb(perm, PCI_INTERRUPT_LINE, (u8)ALL_VIRT, (u8)ALL_WRITE); in init_pci_cap_basic_perm()
694 p_setb(perm, PCI_INTERRUPT_PIN, (u8)ALL_VIRT, (u8)NO_WRITE); in init_pci_cap_basic_perm()
716 int count, struct perm_bits *perm, in vfio_pm_config_write() argument
719 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_pm_config_write()
748 static int __init init_pci_cap_pm_perm(struct perm_bits *perm) in init_pci_cap_pm_perm() argument
750 if (alloc_perm_bits(perm, pci_cap_length[PCI_CAP_ID_PM])) in init_pci_cap_pm_perm()
753 perm->writefn = vfio_pm_config_write; in init_pci_cap_pm_perm()
759 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_pm_perm()
768 p_setw(perm, PCI_PM_PMC, PCI_PM_CAP_PME_MASK, NO_WRITE); in init_pci_cap_pm_perm()
779 p_setd(perm, PCI_PM_CTRL, in init_pci_cap_pm_perm()
788 int count, struct perm_bits *perm, in vfio_vpd_config_write() argument
802 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_vpd_config_write()
832 static int __init init_pci_cap_vpd_perm(struct perm_bits *perm) in init_pci_cap_vpd_perm() argument
834 if (alloc_perm_bits(perm, pci_cap_length[PCI_CAP_ID_VPD])) in init_pci_cap_vpd_perm()
837 perm->writefn = vfio_vpd_config_write; in init_pci_cap_vpd_perm()
843 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_vpd_perm()
849 p_setw(perm, PCI_VPD_ADDR, (u16)ALL_VIRT, (u16)ALL_WRITE); in init_pci_cap_vpd_perm()
850 p_setd(perm, PCI_VPD_DATA, ALL_VIRT, ALL_WRITE); in init_pci_cap_vpd_perm()
856 static int __init init_pci_cap_pcix_perm(struct perm_bits *perm) in init_pci_cap_pcix_perm() argument
859 if (alloc_perm_bits(perm, PCI_CAP_PCIX_SIZEOF_V2)) in init_pci_cap_pcix_perm()
862 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_pcix_perm()
864 p_setw(perm, PCI_X_CMD, NO_VIRT, (u16)ALL_WRITE); in init_pci_cap_pcix_perm()
865 p_setd(perm, PCI_X_ECC_CSR, NO_VIRT, ALL_WRITE); in init_pci_cap_pcix_perm()
870 int count, struct perm_bits *perm, in vfio_exp_config_write() argument
877 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_exp_config_write()
929 static int __init init_pci_cap_exp_perm(struct perm_bits *perm) in init_pci_cap_exp_perm() argument
932 if (alloc_perm_bits(perm, PCI_CAP_EXP_ENDPOINT_SIZEOF_V2)) in init_pci_cap_exp_perm()
935 perm->writefn = vfio_exp_config_write; in init_pci_cap_exp_perm()
937 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_exp_perm()
946 p_setw(perm, PCI_EXP_DEVCTL, in init_pci_cap_exp_perm()
949 p_setw(perm, PCI_EXP_DEVCTL2, NO_VIRT, ~PCI_EXP_DEVCTL2_ARI); in init_pci_cap_exp_perm()
954 int count, struct perm_bits *perm, in vfio_af_config_write() argument
959 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_af_config_write()
990 static int __init init_pci_cap_af_perm(struct perm_bits *perm) in init_pci_cap_af_perm() argument
992 if (alloc_perm_bits(perm, pci_cap_length[PCI_CAP_ID_AF])) in init_pci_cap_af_perm()
995 perm->writefn = vfio_af_config_write; in init_pci_cap_af_perm()
997 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_af_perm()
998 p_setb(perm, PCI_AF_CTRL, PCI_AF_CTRL_FLR, PCI_AF_CTRL_FLR); in init_pci_cap_af_perm()
1003 static int __init init_pci_ext_cap_err_perm(struct perm_bits *perm) in init_pci_ext_cap_err_perm() argument
1007 if (alloc_perm_bits(perm, pci_ext_cap_length[PCI_EXT_CAP_ID_ERR])) in init_pci_ext_cap_err_perm()
1015 p_setd(perm, 0, ALL_VIRT, NO_WRITE); in init_pci_ext_cap_err_perm()
1035 p_setd(perm, PCI_ERR_UNCOR_STATUS, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1036 p_setd(perm, PCI_ERR_UNCOR_MASK, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1037 p_setd(perm, PCI_ERR_UNCOR_SEVER, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1047 p_setd(perm, PCI_ERR_COR_STATUS, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1048 p_setd(perm, PCI_ERR_COR_MASK, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1052 p_setd(perm, PCI_ERR_CAP, NO_VIRT, mask); in init_pci_ext_cap_err_perm()
1057 static int __init init_pci_ext_cap_pwr_perm(struct perm_bits *perm) in init_pci_ext_cap_pwr_perm() argument
1059 if (alloc_perm_bits(perm, pci_ext_cap_length[PCI_EXT_CAP_ID_PWR])) in init_pci_ext_cap_pwr_perm()
1062 p_setd(perm, 0, ALL_VIRT, NO_WRITE); in init_pci_ext_cap_pwr_perm()
1065 p_setb(perm, PCI_PWR_DATA, NO_VIRT, (u8)ALL_WRITE); in init_pci_ext_cap_pwr_perm()
1131 int count, struct perm_bits *perm, in vfio_msi_config_read() argument
1147 return vfio_default_config_read(vdev, pos, count, perm, offset, val); in vfio_msi_config_read()
1151 int count, struct perm_bits *perm, in vfio_msi_config_write() argument
1154 count = vfio_default_config_write(vdev, pos, count, perm, offset, val); in vfio_msi_config_write()
1196 static int init_pci_cap_msi_perm(struct perm_bits *perm, int len, u16 flags) in init_pci_cap_msi_perm() argument
1198 if (alloc_perm_bits(perm, len)) in init_pci_cap_msi_perm()
1201 perm->readfn = vfio_msi_config_read; in init_pci_cap_msi_perm()
1202 perm->writefn = vfio_msi_config_write; in init_pci_cap_msi_perm()
1204 p_setb(perm, PCI_CAP_LIST_NEXT, (u8)ALL_VIRT, NO_WRITE); in init_pci_cap_msi_perm()
1210 p_setb(perm, PCI_MSI_FLAGS, (u8)ALL_VIRT, (u8)ALL_WRITE); in init_pci_cap_msi_perm()
1211 p_setd(perm, PCI_MSI_ADDRESS_LO, ALL_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1213 p_setd(perm, PCI_MSI_ADDRESS_HI, ALL_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1214 p_setw(perm, PCI_MSI_DATA_64, (u16)ALL_VIRT, (u16)ALL_WRITE); in init_pci_cap_msi_perm()
1216 p_setd(perm, PCI_MSI_MASK_64, NO_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1217 p_setd(perm, PCI_MSI_PENDING_64, NO_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1220 p_setw(perm, PCI_MSI_DATA_32, (u16)ALL_VIRT, (u16)ALL_WRITE); in init_pci_cap_msi_perm()
1222 p_setd(perm, PCI_MSI_MASK_32, NO_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1223 p_setd(perm, PCI_MSI_PENDING_32, NO_VIRT, ALL_WRITE); in init_pci_cap_msi_perm()
1866 struct perm_bits *perm; in vfio_config_do_rw() local
1893 perm = &unassigned_perms; in vfio_config_do_rw()
1896 perm = &virt_perms; in vfio_config_do_rw()
1902 perm = &ecap_perms[cap_id]; in vfio_config_do_rw()
1907 perm = &cap_perms[cap_id]; in vfio_config_do_rw()
1910 perm = vdev->msi_perm; in vfio_config_do_rw()
1923 if (!perm->writefn) in vfio_config_do_rw()
1929 ret = perm->writefn(vdev, *ppos, count, perm, offset, val); in vfio_config_do_rw()
1931 if (perm->readfn) { in vfio_config_do_rw()
1932 ret = perm->readfn(vdev, *ppos, count, in vfio_config_do_rw()
1933 perm, offset, &val); in vfio_config_do_rw()