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

[PATCH v8 13/13] xen/arm: account IO handlers for emulated PCI MSI-X


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Thu, 20 Jul 2023 00:32:35 +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=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=zOeSMPEmX5pm3X2mdny5gRhNwdhBLZKMFqHNsWU7Urc=; b=Zy5UCkwd1PL+YvSbZoS9AprGbpEYwmnF5X48sWWe4KttoPrAcpp2v9UDDUqfOeF7B2O33Eygf/tmSRzWwBmywlOZ/1qJjPUPLcnIm1LtrCa6fEj24Ga8ddra4grxxAalhp0RzchLyxrJksbGOlt0nX8aecwRseCvPI8qiplH6Qg9LJIwieupzDAs9fQljEiDESmWOGFS6wGmukEimw2s9FsmFr81/WkpO+9QcwQUaEoRnE984F1oNitEHUziwXKGANBxhwhUY4GVNAUQAjIxuCnYao64IaKeJAsceaiy8mTbvbWougJahYrJbDMaPGSePywGPOGnWcsRgm3Xp04EKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MuNNQsPzZyGbm3cQ4i6q7pkUtW05fdJNEW4n3hl5Q1Bz3DAtWbLTjHUXtfPm6yigIm0GrMDcDbyv0FFn/AZu6eHTRaso/eAReMLGAD7RcqfeoSs2VEwRKwdza5PP5S2pVCJkKnezPXLXzVV3jhTlWMdqflnZBG71g5fZYdHCq/7iY0rbXa9SVWVI83HwQdOTSuGELGqS7nmYaxCObSGJ3KM9wtrX3NDXaRQmZyeJ8s2tXQYTZpfE8AJHPpV1LzgsKoTbZiepLbO8mdjrI5p7Nlh15ELwZZD9Wy5dqg5StRneCh8bNFE+e21Mvz2MnI8mCryCTFcGQIMO6tfeRFCQGw==
  • Cc: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 20 Jul 2023 00:32:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZuqGuy4TImO+CVUmVm6UGc30HEQ==
  • Thread-topic: [PATCH v8 13/13] xen/arm: account IO handlers for emulated PCI MSI-X

From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>

At the moment, we always allocate an extra 16 slots for IO handlers
(see MAX_IO_HANDLER). So while adding IO trap handlers for the emulated
MSI-X registers we need to explicitly tell that we have additional IO
handlers, so those are accounted.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
---
Cc: Julien Grall <julien@xxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
This actually moved here from the part 2 of the prep work for PCI
passthrough on Arm as it seems to be the proper place for it.

Since v5:
- optimize with IS_ENABLED(CONFIG_HAS_PCI_MSI) since VPCI_MAX_VIRT_DEV is
  defined unconditionally
New in v5
---
 xen/arch/arm/vpci.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c
index 66701465af..cd9f5d0757 100644
--- a/xen/arch/arm/vpci.c
+++ b/xen/arch/arm/vpci.c
@@ -148,6 +148,8 @@ static int vpci_get_num_handlers_cb(struct domain *d,
 
 unsigned int domain_vpci_get_num_mmio_handlers(struct domain *d)
 {
+    unsigned int count;
+
     if ( !has_vpci(d) )
         return 0;
 
@@ -168,7 +170,17 @@ unsigned int domain_vpci_get_num_mmio_handlers(struct 
domain *d)
      * For guests each host bridge requires one region to cover the
      * configuration space. At the moment, we only expose a single host bridge.
      */
-    return 1;
+    count = 1;
+
+    /*
+     * There's a single MSI-X MMIO handler that deals with both PBA
+     * and MSI-X tables per each PCI device being passed through.
+     * Maximum number of emulated virtual devices is VPCI_MAX_VIRT_DEV.
+     */
+    if ( IS_ENABLED(CONFIG_HAS_PCI_MSI) )
+        count += VPCI_MAX_VIRT_DEV;
+
+    return count;
 }
 
 /*
-- 
2.41.0



 


Rackspace

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