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

[PATCH] vpci/header: cope with devices not having vpci allocated


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 25 May 2023 10:30:51 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=pSg29f/N1YhWUe1oKVP2tfbEbXqkMVXNz0UXS8Yow8E=; b=L4kGga43soRYHgjRml9K3+jai22AWMMWuvacd00iVUgOFa3GXJ3aUkMX2TCbHr4qMc+eVg36Xo/sFaUYJ7Eul53TAG2wZYMHvxnCtGJU1O4W5UI5Ae8nBdbjcITKagU/IE71JYQNjVKdQaZd3J5niXGWDPu5GmvWm2I16/YcmY3IC8gAyTe7FyNIpX/fp2x9EgZIg6rqMIyQTZ68C2UzpEI1RrmSi3ltL4dRRibIBVeGhEU5c5a3afkOa6fNF99qM9ovC83GPnpFtqdXG0NCQQ/RZtsK4i7xS4spn6O4nBzZHfs5j4igEL8NL92ioVJqo8VqxfZsEwrhmCRzRdU+xQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fKWy6pmni5ibF0o04yvQtkOUGcbQoTtPMg3c6/f+R5ymYeOvrfv0AUy2kcgYMC/h8c5G9qwwD8Qu6TNAKgAYRbw1HXYqxpu3zaW1WpzJ44bgF4nw8CO5oXypouWnKMWhrtMfZnEhiCygNwNjotbC3XfjsTn+LaU2nrdS7RUaU2MWGO69TT4eecjDRF+qvFmRs9M5WDKAJRUg4+c3GcX2opcyOFNU+NNJ+Phb6ztdnZi1OQDhfgS4d3G9nZ7vk/6hQWpiOUbImoBk/0sjHvHcB9gqj+cWuTmX4ikcEVnTYnYGaGHdpaYSBifl75U3raOGh+rv0PEFYa2NFstcsLG7Ag==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: jbeulich@xxxxxxxx, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 25 May 2023 08:31:22 +0000
  • Ironport-data: A9a23:R3gBlqshsvqz7BaQBirl2iI+L+fnVEVfMUV32f8akzHdYApBsoF/q tZmKWiCPK6JZzSnL9Enb4m09U0OvJHUyoQxTgJrrSxhHioW+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVKiffHg3HVQ+IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4rKq4Fv0gnRkPaoQ5AKEyyFJZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMwKg5XYBmomuiMx5mFabltgPkbMo7PM9ZK0p1g5Wmx4fcOZ7nmG/mPz/kImTA6i4ZJAOrUY NcfZXx3dhPcbhZTO1ARTpUjgOOvgXq5eDpdwL6XjfNvvy6Pk0oujP6xabI5efTTLSlRtlyfq W/cuXzwHzkRNcCFyCrD+XWp7gPKtXqiANhITuHpr5aGhnWQ4l0qODQocGKSpP+fkHWhWY1+L WoLr39GQa8asRbDosPGdw21pjuIswARX/JUEvYm80edx6zM+QGbC2MYCDlbZ7QOtsU7WDgr3 V+hhM7yCHpkt7j9dJ6G3rKdrDf3My5FK2YHPXMAVVFdv4Clp5wvhBXSSNolCLSyktD+BTD3x XaNsTQ6gLIQy8UM0s1X4Gz6vt5lnbCRJiZd2+kddjPNAt9RDGJ9W7GV1A==
  • Ironport-hdrordr: A9a23:Lf6EtqtJ7XkPnYrFF+55ifPg7skDYdV00zEX/kB9WHVpm6uj9/ xG/c576faQsl16ZJhOo6HjBED+ewK4yXcY2+Qs1NSZMjUO2lHYT72KhLGKqwEIcBeQygcy78 tdmqFFebnNMWQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When traversing the list of pci devices assigned to a domain cope with
some of them not having the vpci struct allocated. It's possible for
the hardware domain to have read-only devices assigned that are not
handled by vPCI, or for unprivileged domains to have some devices
handled by an emulator different than vPCI.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/drivers/vpci/header.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index ec2e978a4e6b..3c1fcfb208cf 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -289,6 +289,20 @@ 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.
+             *
+             * For unprivileged domains we should aim for passthrough devices
+             * to be capable of being handled by different emulators, and hence
+             * a domain could have some devices handled by vPCI and others by
+             * QEMU for example, and the later won't have pdev->vpci
+             * allocated.
+             */
+            continue;
+
         if ( tmp == pdev )
         {
             /*
-- 
2.40.0




 


Rackspace

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