Message ID | 20230525145405.35348-1-roger.pau@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] vpci/header: cope with devices not having vpci allocated | expand |
On 25.05.2023 16:54, Roger Pau Monne wrote: > When traversing the list of pci devices assigned to a domain cope with > some of them not having the vpci struct allocated. It should be > possible for the hardware domain to have read-only devices assigned > that are not handled by vPCI, such support will be added by further > patches. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> I was wondering whether to put an assertion in (permitting both DomXEN and hwdom, i.e. slightly more relaxed than I had it). Jan
On Thu, May 25, 2023 at 05:22:53PM +0200, Jan Beulich wrote: > On 25.05.2023 16:54, Roger Pau Monne wrote: > > When traversing the list of pci devices assigned to a domain cope with > > some of them not having the vpci struct allocated. It should be > > possible for the hardware domain to have read-only devices assigned > > that are not handled by vPCI, such support will be added by further > > patches. > > > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> > > Reviewed-by: Jan Beulich <jbeulich@suse.com> Thanks. > I was wondering whether to put an assertion in (permitting both DomXEN > and hwdom, i.e. slightly more relaxed than I had it). I also wondered it, but didn't think it was very helpful, but that was back when I had the comment about how I envisioned this to work for domUs. Let me know if you want me to add it. Thanks, Roger.
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index ec2e978a4e6b..766fd98b2196 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -289,6 +289,14 @@ static int modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only) */ for_each_pdev ( pdev->domain, tmp ) { + if ( !tmp->vpci ) + /* + * For the hardware domain it's possible to have devices assigned + * to it that are not handled by vPCI, either because those are + * read-only devices, or because vPCI setup has failed. + */ + continue; + if ( tmp == pdev ) { /*
When traversing the list of pci devices assigned to a domain cope with some of them not having the vpci struct allocated. It should be possible for the hardware domain to have read-only devices assigned that are not handled by vPCI, such support will be added by further patches. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Changes since v1: - Do not mention domU plans. --- xen/drivers/vpci/header.c | 8 ++++++++ 1 file changed, 8 insertions(+)