int pci_conf_write_intercept(unsigned int seg, unsigned int bdf, unsigned int reg, unsigned int size, uint32_t *data) { struct pci_dev *pdev; int rc = xsm_pci_config_permission(XSM_HOOK, current->domain, bdf, reg, reg + size - 1, 1); if ( rc < 0 ) return rc; ASSERT(!rc); /* * Avoid expensive operations when no hook is going to do anything * for the access anyway. */ if ( reg < 64 || reg >= 256 ) return 0; pcidevs_lock(); pdev = pci_get_pdev(seg, PCI_BUS(bdf), PCI_DEVFN2(bdf)); if ( pdev ) rc = pci_msi_conf_write_intercept(pdev, reg, size, data); pcidevs_unlock(); return rc; }
int pci_conf_write_intercept(unsigned int seg, unsigned int bdf, unsigned int reg, unsigned int size, uint32_t *data) { struct pci_dev *pdev; int rc = 0; /* * Avoid expensive operations when no hook is going to do anything * for the access anyway. */ if ( reg < 64 || reg >= 256 ) return 0; spin_lock(&pcidevs_lock); pdev = pci_get_pdev(seg, PCI_BUS(bdf), PCI_DEVFN2(bdf)); if ( pdev ) rc = pci_msi_conf_write_intercept(pdev, reg, size, data); spin_unlock(&pcidevs_lock); return rc; }