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

[PATCH v3 1/7] vpci: rename and export vpci_modify_bars


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Thu, 9 Apr 2026 14:01:32 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=CjlKN+hVcv4fDStYjwfvo9IU/5C6OQvkDnHA+mRGcfQ=; b=qCJ3AG8WyTUCF2ZECa0OxRN33HXfRDKgbfOJ5mYocoa+ZUYakF09SSRgUqJg96OcEYS3wU7vCh4ROdXjT1mXCPqwF9UmsQs0gs8D5+3T3JYzvCooll05carOKcnSJdvMC6lAns1xq1AGpziwuwx1pwxe7YhHoT/5y2DCLAc9vFQkt9/6QJaycwGSbg0GaC5h66fWCPsLyh15bHFfomgcsctS1v/TLgkfcx0K0y6XLnE8hDV44oesCPJHbiEUPiHpKTD+4cvfUuQ57SzWUDhyeUX8V/VkhIweEWBBTIIIHku+DdjDV5Mp2eMoqjIK1OcO1GjX48R1CeYM96FiL3LDxg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u0Gw3SG0rG+rXP57aIcJs3FSDlAyKTjN3tdfPjprLSCm8zrgPKnXXC6++meAUHL9MiEebo0+340debtDOaQiE/N44/AmJZXwjHldOASTlerpnYDWWj/6Da6HsSaPd2xS9hxEk26F79EqBRbLRxLDfL/p+QzXB0td3FkKaUNxZqVMyoEbqlOlB1wivYi6FnrhKXf/oE+PVNpomT6imBnAXV7nu9S3sjDhC3/0B8gMa3d8zpqt0ixnK3t/XCRP/jz7SYyK7hrAlkr7yLABq1+qx1cGbS8VCJjnOzrQ+vs7lhEGIH017cUXwM0XOuK2GY2bJhOibyRWIddepvBGMqezWg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Thu, 09 Apr 2026 14:01:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcyCle4fajjYJKo0m49i60rboCMg==
  • Thread-topic: [PATCH v3 1/7] vpci: rename and export vpci_modify_bars

From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>

Export functions required for SR-IOV support.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
Reviewed-by: Teddy Astie <teddy.astie@xxxxxxxxxx>

---
v2->v3:
* move declaration to private.h

v1->v2
* Collect RBs
---
 xen/drivers/vpci/header.c  | 16 +++++++++-------
 xen/drivers/vpci/private.h |  3 +++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index a760d8c32f..96995e098b 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -305,7 +305,7 @@ static void defer_map(const struct pci_dev *pdev, uint16_t 
cmd, bool rom_only)
     raise_softirq(SCHEDULE_SOFTIRQ);
 }
 
-static int modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only)
+int vpci_modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only)
 {
     struct vpci_header *header = &pdev->vpci->header;
     struct pci_dev *tmp;
@@ -546,7 +546,7 @@ static void cf_check cmd_write(
          * memory decoding bit has not been changed, so leave everything as-is,
          * hoping the guest will realize and try again.
          */
-        modify_bars(pdev, cmd, false);
+        vpci_modify_bars(pdev, cmd, false);
     else
         pci_conf_write16(pdev->sbdf, reg, cmd);
 }
@@ -714,13 +714,15 @@ static void cf_check rom_write(
      * Pass PCI_COMMAND_MEMORY or 0 to signal a map/unmap request, note that
      * this fabricated command is never going to be written to the register.
      */
-    else if ( modify_bars(pdev, new_enabled ? PCI_COMMAND_MEMORY : 0, true) )
+    else if ( vpci_modify_bars(pdev,
+                               new_enabled ? PCI_COMMAND_MEMORY : 0,
+                               true) )
         /*
          * No memory has been added or removed from the p2m (because the actual
          * p2m changes are deferred in defer_map) and the ROM enable bit has
          * not been changed, so leave everything as-is, hoping the guest will
          * realize and try again. It's important to not update rom->addr in the
-         * unmap case if modify_bars has failed, or future attempts would
+         * unmap case if vpci_modify_bars has failed, or future attempts would
          * attempt to unmap the wrong address.
          */
         return;
@@ -800,8 +802,8 @@ int vpci_init_header(struct pci_dev *pdev)
     /*
      * For DomUs, clear PCI_COMMAND_{MASTER,MEMORY,IO} and other
      * DomU-controllable bits in PCI_COMMAND. Devices assigned to DomUs will
-     * start with memory decoding disabled, and modify_bars() will not be 
called
-     * at the end of this function.
+     * start with memory decoding disabled, and vpci_modify_bars() will not be
+     * called at the end of this function.
      */
     if ( !is_hwdom )
         cmd &= ~(PCI_COMMAND_VGA_PALETTE | PCI_COMMAND_INVALIDATE |
@@ -926,7 +928,7 @@ int vpci_init_header(struct pci_dev *pdev)
             goto fail;
     }
 
-    return (cmd & PCI_COMMAND_MEMORY) ? modify_bars(pdev, cmd, false) : 0;
+    return (cmd & PCI_COMMAND_MEMORY) ? vpci_modify_bars(pdev, cmd, false) : 0;
 
  fail:
     pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd);
diff --git a/xen/drivers/vpci/private.h b/xen/drivers/vpci/private.h
index 2907f6b40f..6fdf8a20d9 100644
--- a/xen/drivers/vpci/private.h
+++ b/xen/drivers/vpci/private.h
@@ -138,6 +138,9 @@ static inline size_t vmsix_table_size(const struct vpci 
*vpci, unsigned int nr)
                                                        8), 8);
 }
 
+/* Map/unmap the BARs of a vPCI device. */
+int vpci_modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only);
+
 #endif /* __XEN__ */
 
 #endif /* VPCI_PRIVATE_H */
-- 
2.51.2



 


Rackspace

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