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

[XEN PATCH v2 11/25] arm: new VGIC: Add alternative redist region storage


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Fri, 10 Nov 2023 12:56:19 +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=pfknAyVbOV3k83G7QQT0Ng9GKon0GixOx1/IoSh2cog=; b=A2zPt+dCn0CfV12FoUsMbCTm1zpPCA1Ro9TzeKn7zWPfhGlXbKaLSYsXc0LhpRVDuxMFd/rwHbRKieJHX+BaIdebMcb046L4QKKA35phXnXD0LYm+ZQw7Df4p1EYEsD5Sywp1dSoM6Dr4Ze/ypYnI1HWPtEaI6w936tgij0b6KKHz1bAT2dnKZhRlen/v9Ub+lrDbTWUo4rbgaazkw32v12pG5yHbLZF+Pj/GR/TH3pcOIxDjAvyZ3PD6tBwxTMf/aRr0keJv+qdivX9wsNwbQ0SYQH0SkDhf0UU9YG+l6nkIzCWS1HalJ4iZXDiRFRvc0Pk8EpQuq8vK57lWU2nJA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RA2RnrvW+EUyLfp/seqNTbfZQD+HllClxQpdD5raPdsNB7R5KOjyfjEJl4l2Te+y2ua2hAs7sAUlZu1AgV2AJS+cOrdFfbNmHAWVNiCe75JlSiUL/JaVK8OMKLlUSZmxQQLXc063qOheCbYOl/+g5QfJM/LVbNGtX4gsfIN1lOIxjgaWJaQBrPKJBzuec2SE09gQTk7IMTLMbGNsvFSgpPFO9dmemrmS0dq9NShF/SOtM9QKAMSQEEcQf+1k4EyBq+1uYirytajDJefK6YC74T6i+xXe2D5iaoUqk0rwe+QWSoNk8Ofodru1En6nSmNAlv7MgLkoxGWYbDOTgQCfsA==
  • Cc: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Fri, 10 Nov 2023 12:56:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHaE9VMKrSrAG80rkWu3ywErkCXJw==
  • Thread-topic: [XEN PATCH v2 11/25] arm: new VGIC: Add alternative redist region storage

Guests DT creation requires redist regions to be stored in the specific
variables in struct vgic_dist. But in new VGIC a linked list is used for
that. To not clutter the DT creation code with ifdefs, add alternative
storage for redist regions in struct vgic_dist.

Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
---
 xen/arch/arm/include/asm/new_vgic.h | 5 +++++
 xen/arch/arm/vgic/vgic-v3.c         | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/xen/arch/arm/include/asm/new_vgic.h 
b/xen/arch/arm/include/asm/new_vgic.h
index 11d8f71851..9eafab45ff 100644
--- a/xen/arch/arm/include/asm/new_vgic.h
+++ b/xen/arch/arm/include/asm/new_vgic.h
@@ -21,6 +21,7 @@
 #include <xen/list.h>
 #include <xen/mm.h>
 #include <xen/spinlock.h>
+#include <asm/gic_v3_defs.h>
 
 #define VGIC_V3_MAX_CPUS        255
 #define VGIC_V2_MAX_CPUS        8
@@ -136,6 +137,10 @@ struct vgic_dist {
     paddr_t             csize; /* CPU interface size */
     paddr_t             vbase; /* virtual CPU interface base address */
 
+    /* for compatibility with guests DT creation*/
+    uint32_t nr_regions;
+    struct rdist_region *rdist_regions;
+
     /* distributor enabled */
     bool                enabled;
 
diff --git a/xen/arch/arm/vgic/vgic-v3.c b/xen/arch/arm/vgic/vgic-v3.c
index 682d57b476..8b700609f0 100644
--- a/xen/arch/arm/vgic/vgic-v3.c
+++ b/xen/arch/arm/vgic/vgic-v3.c
@@ -257,6 +257,10 @@ int vgic_v3_map_resources(struct domain *d)
     /* Allocate memory for Re-distributor regions */
     rdist_count = vgic_v3_max_rdist_count(d);
 
+    /*For compatibility with hwdom dt node creation*/
+    d->arch.vgic.nr_regions = rdist_count;
+    d->arch.vgic.rdist_regions = xzalloc_array(struct rdist_region, 
rdist_count);
+
     /*
      * For domain using the host memory layout, it gets the hardware
      * address.
@@ -268,6 +272,8 @@ int vgic_v3_map_resources(struct domain *d)
 
         for ( i = 0; i < vgic_v3_hw_data.nr_rdist_regions; i++ )
         {
+            d->arch.vgic.rdist_regions[i].base = 
vgic_v3_hw_data.regions[i].base;
+            d->arch.vgic.rdist_regions[i].size = 
vgic_v3_hw_data.regions[i].size;
             vgic_v3_set_redist_base(d, i, vgic_v3_hw_data.regions[i].base,
                                     vgic_v3_hw_data.regions[i].size /
                                         GICV3_GICR_SIZE);
@@ -276,6 +282,8 @@ int vgic_v3_map_resources(struct domain *d)
     else
     {
         d->arch.vgic.dbase = GUEST_GICV3_GICD_BASE;
+        d->arch.vgic.rdist_regions[0].base = GUEST_GICV3_GICR0_BASE;
+        d->arch.vgic.rdist_regions[0].size = GUEST_GICV3_GICR0_SIZE;
 
         /* A single Re-distributor region is mapped for the guest. */
         BUILD_BUG_ON(GUEST_GICV3_RDIST_REGIONS != 1);
-- 
2.34.1



 


Rackspace

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