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

[PATCH v9 16/16] xen/arm: vpci: permit access to guest vpci space


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Tue, 29 Aug 2023 23:19:47 +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=OnW6xmOMSUh88tcDS5xktaqBw+mFQg2UICEpESoViDY=; b=g+3rxJAGjDtfGmIANR04W3wZOtgKciMD1je3u/NYIhyKQnfxL5snKYiD7tXMtSsLubQVaegJ29FZllrzu4W4YH4xoJvVdaqwSriY7+8ZXOgJr3ZMQIDG75b1vKDpXLnvpwRXHp8VDdYpkxb+532/t14WLG9tpoOsiWXV8tzSGz705kPUGiL3gi4Sknajh4nsegzQkRcsLcWOBFMgQPCjGit0DfT+E6BLCu0MOnJvD2JiiRnCkIPLfCuy7p7gmFONxHkmB8t2hUq5YjDV7iACbS0nR6ZGxtBlE0A/8mhtA7fBNHt0cNaAiX8B0qGvijXH6lt00j1AQPSkLGFK1j/1pA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=InF9Vra4KEmrtfxMliPMa31i+AhiWoPQUOQB2KkTpiqA9EotOZoN5+qO6ISjBPI1bkXHG3OKu3py6fix3C+ajg+JSsVJGpG1vH7xR7QyTZkxou/RZeDjdlsWh2YSKFW4F51zj5pyThKfG8Gq8IO3IdIDUFHTqDRa/DxjdDbHuRYdqLdUnDsK0Ram0TGBYnUxjW8uyyQyd+B8nsccUdqQa40z4QhLfo7e91b0DeW1LusbTSRsBSsAjiTHE+NrmsMSCPSb3suAl/MFcbzpj+ZQ2+/aFrrf+8Lz1OPv2VQmx7/FFjrvDHCiyZO7qgcLQEwf7HIoYqeQtQ4WBYhN/1XocQ==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 29 Aug 2023 23:20:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZ2s9N0IXatP2juE67AItmuC0joQ==
  • Thread-topic: [PATCH v9 16/16] xen/arm: vpci: permit access to guest vpci space

From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>

Move iomem_caps initialization earlier (before arch_domain_create()).

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
---
This is sort of a follow-up to:

  baa6ea700386 ("vpci: add permission checks to map_range()")

I don't believe we need a fixes tag since this depends on the vPCI p2m BAR
patches.
---
 xen/arch/arm/vpci.c | 6 ++++++
 xen/common/domain.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c
index 01b50d435e..fb5361276f 100644
--- a/xen/arch/arm/vpci.c
+++ b/xen/arch/arm/vpci.c
@@ -2,6 +2,7 @@
 /*
  * xen/arch/arm/vpci.c
  */
+#include <xen/iocap.h>
 #include <xen/sched.h>
 #include <xen/vpci.h>
 
@@ -119,8 +120,13 @@ int domain_vpci_init(struct domain *d)
             return ret;
     }
     else
+    {
         register_mmio_handler(d, &vpci_mmio_handler,
                               GUEST_VPCI_ECAM_BASE, GUEST_VPCI_ECAM_SIZE, 
NULL);
+        iomem_permit_access(d, paddr_to_pfn(GUEST_VPCI_MEM_ADDR),
+                            paddr_to_pfn(PAGE_ALIGN(GUEST_VPCI_MEM_ADDR +
+                                                    GUEST_VPCI_MEM_SIZE - 1)));
+    }
 
     return 0;
 }
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 9b04a20160..11a48ba7e4 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -695,6 +695,9 @@ struct domain *domain_create(domid_t domid,
         radix_tree_init(&d->pirq_tree);
     }
 
+    if ( !is_idle_domain(d) )
+        d->iomem_caps = rangeset_new(d, "I/O Memory", 
RANGESETF_prettyprint_hex);
+
     if ( (err = arch_domain_create(d, config, flags)) != 0 )
         goto fail;
     init_status |= INIT_arch;
@@ -704,7 +707,6 @@ struct domain *domain_create(domid_t domid,
         watchdog_domain_init(d);
         init_status |= INIT_watchdog;
 
-        d->iomem_caps = rangeset_new(d, "I/O Memory", 
RANGESETF_prettyprint_hex);
         d->irq_caps   = rangeset_new(d, "Interrupts", 0);
         if ( !d->iomem_caps || !d->irq_caps )
             goto fail;
-- 
2.41.0



 


Rackspace

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