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

[PATCH v3 2/5] xen/arm: pci: plumb xen_arch_domainconfig with pci info


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Mon, 9 Oct 2023 15:57:41 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=EmlGqKWuCnjtMUmBTT4XxuCpBI3jirRl8+SAumX9cok=; b=ZQqI+mAJ0N1Hp1G9+KNw7nn5vPqp56HjgteOaXvbsRoVzb+uBYV1IGAZPHqCrThxlee8KprxdVUehT3O2wiCP+kl54LC4TepGXfT1qDJrKmQCfADpC4bVioMHdSxUBfprXkIsyGf1OHB3fLMNiJaDsmP5Ik0p9PrU1yo8KbEbQU5otZnSDT2ROeWb51/LgXKRPhIdKcmAjONm0GpKMf8uCKRkJkOcUxu22ZrzZwZbnk+pghs5EkDap+XdrqU0YAAyktBjqLHFuIgEPNFiMG4A/+qxayJKpSWoVtMBcNIPiJMoaVD22IoTLBGWRDQG/2DcAVeyUNWLXGdduLRBJ/UxA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X98xNMBmrTWnBRF/PrQMksTjP8Ww9l7DhxPVIrTMb0qhdX34siUTpiqOvplT3+9kk+BZsMklLZtgsbsJxtuJxcUHEUT9dRfdWjyG/x72aQ7PKILsTsOnY93h7W6M8o1i87KYzV+/mJ7ypAvSDcPNt7C7m9TvRxRMdFoYcWnKfof8tP52/MulZQGlfrGpDd1s7k8tBnEhcsbffPeUg5JLHQGIWb1Bw3kZB+Ra5xlNUuom1p5BCS8DhIQi8Pq7baWcAd+PON62UWZ21vSEhhaDNaMGCULhyKnQ6w15MQlveNo/pdDp9WG6VmlJolOOQVOEe/83WSjBY9JFI+KgvNT2Hw==
  • 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>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 09 Oct 2023 19:58:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Add a flag to struct xen_arch_domainconfig to allow specifying at domain
creation time whether the domain uses vPCI.

Add a corresponding flag to struct arch_domain to indicate vPCI and set it
accordingly.

Bump XEN_DOMCTL_INTERFACE_VERSION since we're modifying struct
xen_arch_domainconfig.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
---
v2->v3:
* new patch
---
 xen/arch/arm/domain.c             | 10 ++++++++++
 xen/arch/arm/include/asm/domain.h |  2 ++
 xen/include/public/arch-arm.h     |  4 ++++
 xen/include/public/domctl.h       |  2 +-
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 28e3aaa5e482..9470c28595da 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -687,6 +687,13 @@ int arch_sanitise_domain_config(struct 
xen_domctl_createdomain *config)
         return -EINVAL;
     }
 
+    if ( (config->arch.pci_flags & XEN_DOMCTL_CONFIG_PCI_VPCI) &&
+         !IS_ENABLED(CONFIG_HAS_VPCI) )
+    {
+        dprintk(XENLOG_INFO, "vPCI support not enabled\n");
+        return -EINVAL;
+    }
+
     return 0;
 }
 
@@ -737,6 +744,9 @@ int arch_domain_create(struct domain *d,
         BUG();
     }
 
+    if ( config->arch.pci_flags & XEN_DOMCTL_CONFIG_PCI_VPCI )
+        d->arch.has_vpci = true;
+
     if ( (rc = domain_vgic_register(d, &count)) != 0 )
         goto fail;
 
diff --git a/xen/arch/arm/include/asm/domain.h 
b/xen/arch/arm/include/asm/domain.h
index 99e798ffff68..0a66ed09a617 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -119,6 +119,8 @@ struct arch_domain
     void *tee;
 #endif
 
+    bool has_vpci;
+
 }  __cacheline_aligned;
 
 struct arch_vcpu
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 6a4467e8f5d1..5c8424341aad 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -300,6 +300,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 #define XEN_DOMCTL_CONFIG_TEE_OPTEE     1
 #define XEN_DOMCTL_CONFIG_TEE_FFA       2
 
+#define XEN_DOMCTL_CONFIG_PCI_VPCI      (1U << 0)
+
 struct xen_arch_domainconfig {
     /* IN/OUT */
     uint8_t gic_version;
@@ -323,6 +325,8 @@ struct xen_arch_domainconfig {
      *
      */
     uint32_t clock_frequency;
+    /* IN */
+    uint8_t pci_flags;
 };
 #endif /* __XEN__ || __XEN_TOOLS__ */
 
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index a33f9ec32b08..dcd42b3d603d 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -21,7 +21,7 @@
 #include "hvm/save.h"
 #include "memory.h"
 
-#define XEN_DOMCTL_INTERFACE_VERSION 0x00000016
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000017
 
 /*
  * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
-- 
2.42.0




 


Rackspace

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