On 8/28/23 13:56, Stewart Hildebrand wrote: > diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c > index 4a4dbb69ab1c..919addbfa630 100644 > --- a/xen/drivers/vpci/header.c > +++ b/xen/drivers/vpci/header.c > @@ -561,6 +573,71 @@ static int cf_check init_bars(struct pci_dev *pdev) > if ( rc ) > return rc; > > + if ( !is_hardware_domain(pdev->domain) ) > + { > + if ( !(pci_conf_read16(pdev->sbdf, PCI_STATUS) & > PCI_STATUS_CAP_LIST) ) > + { > + /* RAZ/WI */ > + rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL, > + PCI_CAPABILITY_LIST, 1, (void *)0); > + if ( rc ) > + return rc; > + } > + else > + { > + /* Only expose capabilities to the guest that vPCI can handle. */ > + uint8_t next;
s/uint8_t/unsigned int/ > + unsigned int ttl = 48; > + > + next = pci_find_next_cap_ttl(pdev->sbdf, PCI_CAPABILITY_LIST, > + vpci_cap_supported, 0, &ttl); > + > + rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL, > + PCI_CAPABILITY_LIST, 1, > + (void *)(uintptr_t)next); > + if ( rc ) > + return rc; > + > + next &= ~3; > + > + if ( !next ) > + /* > + * If we don't have any supported capabilities to expose to > the > + * guest, mask the PCI_STATUS_CAP_LIST bit in the status > + * register. > + */ > + header->mask_cap_list = true; > + > + while ( next && ttl ) > + { > + uint8_t pos = next; s/uint8_t/unsigned int/