[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RFC v2] vPCI: account for hidden devices


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 25 May 2023 16:39:51 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FYNH3iEaPXt1PGD9HSjTtWX/XIVVJiQGo3QmL6Kn4+s=; b=ELC/6bnOts+J0QW22JfheEHQo6Ppt9RAicA8npsszRwNTu1gBEL9SVgoa2TSabiPn6FCRErGrLwzInIXhnA8c7E/b1ViPwumtK3B+lJvNuDhMS1YfhygUFNJXBiVdchiY1RN4tNlA0q0RY+SYwfNNLjpmJt+ZQyuCpvL02LE2VrfdB+DiwBH43sYjaGNvcIBUrL+f20041msrjqpx77o2qjPKi7cxmNhbWLBCRyjWZhg3v8ay8ZXepLcoyfManC74x81kxQEU8L/iyAPOVqWcI9QBw81w7yUlHhZPzSvMxdm7o+/cHIX47ciNPMvMX+UKB4n+xobrkzNk2T5xlGFAw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QyvSfGat793pFeYC1aQElEm0tx+434NJKlA3OxBJaMnu2JHukG9jNd5DeIn/ZZmI1gdvgXTyDqyBoyaWV2B3dx39PLipiIobDHRLCGKzu9B78FfKFggV4wfKyTZOprLQM84xWxhzo07ZLHJDgp100S0zlU5ed0DBnBfTvumKy48eBDb+pd5F+Gcibapjm4QdD/1p/+hgVzkzj0iuj1TKt7+sljYlZF/0e0EYHhVN4mJVWND9IRm8EZYgIzMZG2O8yqsTTltxKM2OQCl2raW1ckU0erNAfAv8kruvmYfO1Sla/ACRs6jy7thDlt+4G0D4CLSuwiKZq53t+zQUxztUqw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 25 May 2023 14:40:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24.05.2023 17:56, Roger Pau Monné wrote:
> On Wed, May 24, 2023 at 03:45:58PM +0200, Jan Beulich wrote:
>> --- a/xen/drivers/vpci/header.c
>> +++ b/xen/drivers/vpci/header.c
>> @@ -218,6 +218,7 @@ static int modify_bars(const struct pci_
>>      struct vpci_header *header = &pdev->vpci->header;
>>      struct rangeset *mem = rangeset_new(NULL, NULL, 0);
>>      struct pci_dev *tmp, *dev = NULL;
>> +    const struct domain *d;
>>      const struct vpci_msix *msix = pdev->vpci->msix;
>>      unsigned int i;
>>      int rc;
>> @@ -285,9 +286,11 @@ static int modify_bars(const struct pci_
>>  
>>      /*
>>       * Check for overlaps with other BARs. Note that only BARs that are
>> -     * currently mapped (enabled) are checked for overlaps.
>> +     * currently mapped (enabled) are checked for overlaps. Note also that
>> +     * for Dom0 we also need to include hidden, i.e. DomXEN's, devices.
>>       */
>> -    for_each_pdev ( pdev->domain, tmp )
>> +for ( d = pdev->domain; ; d = dom_xen ) {//todo
> 
> Looking at this again, I think this is slightly more complex, as during
> runtime dom0 will get here with pdev->domain == hardware_domain OR
> dom_xen, and hence you also need to account that devices that have
> pdev->domain == dom_xen need to iterate over devices that belong to
> the hardware_domain, ie:
> 
> for ( d = pdev->domain; ;
>       d = (pdev->domain == dom_xen) ? hardware_domain : dom_xen )

Right, something along these lines. To keep loop continuation expression
and exit condition simple, I'll probably prefer

for ( d = pdev->domain != dom_xen ? pdev->domain : hardware_domain;
      ; d = dom_xen )

> And we likely want to limit this to devices that belong to the
> hardware_domain or to dom_xen (in preparation for vPCI being used for
> domUs).

I'm afraid I don't understand this remark, though.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.