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

[PATCH RFC] vPCI: account for hidden devices in modify_bars()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 30 Aug 2021 15:04:55 +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-SenderADCheck; bh=h4jbZC34YKTDxv89AjMP9DMx0JY0uxFi3geIdWtFbDc=; b=QDdoLWIS1SP96qUVUiBbvvJWI//WF50FeBT0ww69wnpfzTWdUsIMQcMQ2ifrMk2GxfY0shtThEMln6d08MZooCgyJKwc5ctgYNHTHxNbjnNzHAxuMJBSzeO9AbUr9qGhXyIYFXrn6wY0vl5DPrUPfsOWjYIijyTwBwKjHaKDdNmErCjt9GJ7tJlsijHqdbJ2UK3KaAxA89EcsNodVS5mN6ufGGKotGpqG27h70SSRuKF/C5kYxOwgB9Ggy1UKZUwmr4slbtvixjeXv4wBYUycZxrxsEimTgsa6yteZgsg2eJcEgH5qEGFBwtuS+sVpp0UZTG9Od9ZC0BbXEGhYHPlw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GLLH6A4SSwMQtndh5vs074hKGT2ySeQgNe5+hIMSLtKFIbvXYoCy5GWE2Ib6/ug8tCLmaR04uPVhv1zQliYGTHXcBI88+lp4NZwATCpUJw2lEDiYyjG7e4KZkcPu/E6KTYYmk/xvcpWh6Wb+p93QG/RKkeaU/FlB7WijA14cIzPjZt4iVF4jX47WBFO97P4Iy23McRQmTFgtKr8td8fFVP9imqpGUVuEq+WXbr+Vl2Abm9qkSxqKBJjdFsetp7/l6k194ASAR+PioWyQxPhQ4hCjgGWRX3ysfYdb9PWpWsB3Vx7RFpcgS2dRPJd89IuvqIGd5WwzIcY05/NGntP2jQ==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 30 Aug 2021 13:05:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hidden devices (e.g. an add-in PCI serial card used for Xen's serial
console) are associated with DomXEN, not Dom0. This means that while
looking for overlapping BARs such devices cannot be found on Dom0's
list of devices; DomXEN's list also needs to be scanned.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
RFC: Patch intentionally mis-formatted, as the necessary re-indentation
     would make the diff difficult to read. At this point I'd merely
     like to gather input towards possible better approaches to solve
     the issue (not the least because quite possibly there are further
     places needing changing).

--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -206,6 +206,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;
@@ -265,7 +266,8 @@ 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.
      */
-    for_each_pdev ( pdev->domain, tmp )
+for ( d = pdev->domain; ; d = dom_xen ) {//todo
+    for_each_pdev ( d, tmp )
     {
         if ( tmp == pdev )
         {
@@ -282,6 +284,7 @@ static int modify_bars(const struct pci_
                  */
                 continue;
         }
+if ( !tmp->vpci ) { ASSERT(d == dom_xen && system_state < SYS_STATE_active); 
continue; }//todo
 
         for ( i = 0; i < ARRAY_SIZE(tmp->vpci->header.bars); i++ )
         {
@@ -308,6 +311,7 @@ static int modify_bars(const struct pci_
             }
         }
     }
+if ( !is_hardware_domain(d) ) break; }//todo
 
     ASSERT(dev);
 




 


Rackspace

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