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

[XEN PATCH v2 10/25] arm: new VGIC: Add vgic_v3_enable


  • 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=OrJr290kqOYWcHNBNqtriz0Bdb13RzHLmBg6eDZlzlM=; b=dV+Mj8IOE42jVaEK+ZOYfFoKSTMmOy8jeDgakR9PBYQ386+CALJQbbPk5UlYpOoOKZ5y8FgEbA+p3UbPMr9VqHfG/3JS3DmRXKRPUxR53auW1gzpQqHo+SSU0INKGNvBHMJRBVz3ntScdE8js6Sn36IHrGIc2HM2+FQ6otU8PJvSf8N930BWllcqWS/GapkFrqDW6rYpNSQAPY5R9C9e+GhHDYqcvn4x/YJ4cnYCGXbsDgbqZk9d9sLKlm01H3RQ4SfHfX2wIYOVLWRdLRiMhqytOtTCRtA2aCuodptdWTT5TtxpaORfIDXiMrT3RXV8yrzEIFmUtf0kzK9WmQjOdQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i1frpE2z4v6SX/MgVMj4nB6SmsMeVg6hrI6qpEPqseyifEwCaviV4mMw3/5FCD4tr780NbnHcAts7nM03HQGxfUXTY8ZRVt0p/lxK2pZ/+HYZNaa2LxZvV5m2+LnUayyx4C5MbzFOAThZSarGukIjGs0C6pjgBM6WmCdVWk1cMhYkjYC4706KV44yKhCUnolK6ZZr01dO0bUEV9xw/+An1doX7Jgm1qZbV8nCjFFHwyHreC4bEOzmxqO5hYoUwuviAth2Bu+aj4fSmyTdSfLgHVJsEfsRv4JTmpxLavIF/RHDOz3DzYc2Xiju9bNt5j3/pm1VHR2WABOhp3YBJo/Pw==
  • 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 13:25:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHaE9VMc/Cvb+GfokOTI4WmaNuX9Q==
  • Thread-topic: [XEN PATCH v2 10/25] arm: new VGIC: Add vgic_v3_enable

Enable the VGIC operation by properly initialising the registers
in the hypervisor GIC interface.

This is based on Linux commit f7b6985cc3d0f by Eric Auger

Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
---
 xen/arch/arm/vgic/vgic-init.c | 5 +++++
 xen/arch/arm/vgic/vgic-v3.c   | 6 ++++++
 xen/arch/arm/vgic/vgic.h      | 4 ++++
 3 files changed, 15 insertions(+)

diff --git a/xen/arch/arm/vgic/vgic-init.c b/xen/arch/arm/vgic/vgic-init.c
index ca13cf385c..96f6669d38 100644
--- a/xen/arch/arm/vgic/vgic-init.c
+++ b/xen/arch/arm/vgic/vgic-init.c
@@ -209,9 +209,14 @@ int vcpu_vgic_init(struct vcpu *v)
     vgic_vcpu_early_init(v);
 
     if ( gic_hw_version() == GIC_V2 )
+    {
         vgic_v2_enable(v);
+    }
     else
+    {
         vgic_register_redist_iodev(v);
+        vgic_v3_enable(v);
+    }
 
     return ret;
 }
diff --git a/xen/arch/arm/vgic/vgic-v3.c b/xen/arch/arm/vgic/vgic-v3.c
index 470bb63147..682d57b476 100644
--- a/xen/arch/arm/vgic/vgic-v3.c
+++ b/xen/arch/arm/vgic/vgic-v3.c
@@ -244,6 +244,12 @@ unsigned int vgic_v3_max_rdist_count(const struct domain 
*d)
                                      : GUEST_GICV3_RDIST_REGIONS;
 }
 
+void vgic_v3_enable(struct vcpu *vcpu)
+{
+    /* Get the show on the road... */
+    gic_hw_ops->update_hcr_status(GICH_HCR_EN, true);
+}
+
 int vgic_v3_map_resources(struct domain *d)
 {
     int rdist_count, i, ret;
diff --git a/xen/arch/arm/vgic/vgic.h b/xen/arch/arm/vgic/vgic.h
index 7dbadf7501..791c91ebb3 100644
--- a/xen/arch/arm/vgic/vgic.h
+++ b/xen/arch/arm/vgic/vgic.h
@@ -74,6 +74,7 @@ int vgic_register_dist_iodev(struct domain *d, gfn_t 
dist_base_fn,
 #ifdef CONFIG_GICV3
 void vgic_v3_fold_lr_state(struct vcpu *vcpu);
 void vgic_v3_populate_lr(struct vcpu *vcpu, struct vgic_irq *irq, int lr);
+void vgic_v3_enable(struct vcpu *vcpu);
 int vgic_v3_map_resources(struct domain *d);
 bool vgic_v3_emulate_reg(struct cpu_user_regs *regs, union hsr hsr);
 unsigned int vgic_v3_init_dist_iodev(struct vgic_io_device *dev);
@@ -86,6 +87,9 @@ static inline void vgic_v3_fold_lr_state(struct vcpu *vcpu)
 static inline void vgic_v3_populate_lr(struct vcpu *vcpu, struct vgic_irq 
*irq, int lr)
 {
 }
+static inline void vgic_v3_enable(struct vcpu *vcpu)
+{
+}
 static inline int vgic_v3_map_resources(struct domain *d)
 {
     return 0;
-- 
2.34.1



 


Rackspace

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