Re: [Xen-devel] [PATCH v2 08/11] vpci/header: allow multiple map operations
>>> On 17.07.18 at 11:48, wrote: > --- a/xen/drivers/vpci/header.c > +++ b/xen/drivers/vpci/header.c > @@ -184,7 +184,19 @@ static void defer_map(struct domain *d, struct pci_dev > *pdev, > * started for the same device if the domain is not well-behaved. > */ > curr->vpci.pdev = pdev; > -curr->vpci.mem = mem; > +if ( !curr->vpci.mem ) > +curr->vpci.mem = mem; > +else > +{ > +int rc = rangeset_merge(curr->vpci.mem, mem); > + > +if ( rc ) > +gprintk(XENLOG_WARNING, > +"%04x:%02x:%02x.%u: unable to %smap memory region: %d\n", > +pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn), > +PCI_FUNC(pdev->devfn), map ? "" : "un", rc); > +rangeset_destroy(mem); > +} > curr->vpci.map = map; > curr->vpci.rom_only = rom_only; Is it certain that all other arguments match (pdev, map, rom_only)? If so, please add ASSERT()s to that effect, and perhaps also half a sentence to the description as to why that is guaranteed. Jan ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH v2 08/11] vpci/header: allow multiple map operations
To be queued in vpci_vcpu. This will be required for SR-IOV support, which uses a single control register bit to toggle memory decoding for all the virtual functions. No functional change expected. Signed-off-by: Roger Pau Monné Reviewed-by: Wei Liu --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Wei Liu --- xen/drivers/vpci/header.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index 17a9dbb0bf..2e78f8d4a6 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -184,7 +184,19 @@ static void defer_map(struct domain *d, struct pci_dev *pdev, * started for the same device if the domain is not well-behaved. */ curr->vpci.pdev = pdev; -curr->vpci.mem = mem; +if ( !curr->vpci.mem ) +curr->vpci.mem = mem; +else +{ +int rc = rangeset_merge(curr->vpci.mem, mem); + +if ( rc ) +gprintk(XENLOG_WARNING, +"%04x:%02x:%02x.%u: unable to %smap memory region: %d\n", +pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn), +PCI_FUNC(pdev->devfn), map ? "" : "un", rc); +rangeset_destroy(mem); +} curr->vpci.map = map; curr->vpci.rom_only = rom_only; } -- 2.17.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel