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

[RFC PATCH 04/19] arm/its: Add vlpi configuration


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Mon, 2 Feb 2026 16:14:38 +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=arcselector10001; 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=pUeEU3bbSuS4RygDqfWI+sk2Oq51A0Lc+fee+eE/fIY=; b=PkTG8pYtHmP6qCNyre2QrVBU/6IpjFc3Hy6xGBdRqqfH/OhNKxTAQ9bK3xUeGQmuliDvXH1Lf9OHfT4LUY4ImJkmOvqbbeVlIQ5iQ++vzihuC/JMo7sFvJRWyUwHOc1Jv4WOiRg8EdmVsec3OLN4/lDODgGUZXgAYhlLJM9DgTXTweK9mEyuboCWx0qFI2Ur7X9+YHApuhF2Jwi8I/UYM5TyUTua8juc7OxRG+JVYZ4wN0hxLCXgQGJNE4SEDz4RQ4pnmf3Y+T50somjdP7CPpsZQnao6gesWmG417wPR8bFWGvDDuBp8mkqt0jlY9GXBnsjjMuM2Yj3qkq0kInV1w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FkfBReS2bO5x3YjBb8sJouEd1H704fJBtv5NyxTt2Ww060GltEgRw55PHzKcF8N9UQbonQGcuWmEkw5XpWizgEnTvU3ofdLNEdIADWnQtteat9Rjx2NO9xm/ZPdCIz77FDZauJCzJtfMvYb3hSAHSMMu1csAdiZh56wQW0nT3w4u57rpSBLipOKKu47RYbQGbPifSycKVHQkHfi03bWJCXZRoaAQo4bVbbHlnX1Juvyh++cEPAuJhKC9b2etqVhLVRRmnE/mu+DpukF4O1tLdOfBGJsiiNHphx56BRhnMUmWEwADph/1PubS+sXcqpvF7seufbSGxqzcOZnzUbwRvA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: "xakep.amatop@xxxxxxxxx" <xakep.amatop@xxxxxxxxx>, Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 02 Feb 2026 16:14:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHclF8He0hTGFqEmEaW888dgnQDnw==
  • Thread-topic: [RFC PATCH 04/19] arm/its: Add vlpi configuration

Add a helper to write LPI configuration entries. Expose lpi_data
structure in the header to be used in said helper.

Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
---
 xen/arch/arm/gic-v3-lpi.c             | 39 +++++++++++----------------
 xen/arch/arm/include/asm/gic_v3_its.h | 27 +++++++++++++++++++
 2 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index de5052e5cf..c029d5d7a4 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -46,29 +46,7 @@ union host_lpi {
 #define LPI_PROPTABLE_NEEDS_FLUSHING    (1U << 0)
 
 /* Global state */
-static struct {
-    /* The global LPI property table, shared by all redistributors. */
-    uint8_t *lpi_property;
-    /*
-     * A two-level table to lookup LPIs firing on the host and look up the
-     * VCPU and virtual LPI number to inject into.
-     */
-    union host_lpi **host_lpis;
-    /*
-     * Number of physical LPIs the host supports. This is a property of
-     * the GIC hardware. We depart from the habit of naming these things
-     * "physical" in Xen, as the GICv3/4 spec uses the term "physical LPI"
-     * in a different context to differentiate them from "virtual LPIs".
-     */
-    unsigned long int max_host_lpi_ids;
-    /*
-     * Protects allocation and deallocation of host LPIs and next_free_lpi,
-     * but not the actual data stored in the host_lpi entry.
-     */
-    spinlock_t host_lpis_lock;
-    uint32_t next_free_lpi;
-    unsigned int flags;
-} lpi_data;
+struct __lpi_data lpi_data;
 
 struct lpi_redist_data {
     paddr_t             redist_addr;
@@ -492,6 +470,21 @@ static int find_unused_host_lpi(uint32_t start, uint32_t 
*index)
     return -1;
 }
 
+void lpi_write_config(uint8_t *prop_table, uint32_t lpi, uint8_t clr,
+                      uint8_t set)
+{
+    u8 *cfg;
+
+    cfg = prop_table + lpi - LPI_OFFSET;
+    *cfg &= ~clr;
+    *cfg |= set | LPI_PROP_RES1;
+
+    /* Make the above write visible to the redistributors. */
+    if ( lpi_data.flags & LPI_PROPTABLE_NEEDS_FLUSHING ) {
+        clean_and_invalidate_dcache_va_range(cfg, sizeof(*cfg));
+    }
+}
+
 /*
  * Allocate a block of 32 LPIs on the given host ITS for device "devid",
  * starting with "eventid". Put them into the respective ITT by issuing a
diff --git a/xen/arch/arm/include/asm/gic_v3_its.h 
b/xen/arch/arm/include/asm/gic_v3_its.h
index aa54e9a364..9f0ea9ccb1 100644
--- a/xen/arch/arm/include/asm/gic_v3_its.h
+++ b/xen/arch/arm/include/asm/gic_v3_its.h
@@ -157,6 +157,31 @@ int gicv3_its_setup_collection(unsigned int cpu);
 
 #ifdef CONFIG_HAS_ITS
 
+struct __lpi_data {
+    /* The global LPI property table, shared by all redistributors. */
+    uint8_t *lpi_property;
+    /*
+     * A two-level table to lookup LPIs firing on the host and look up the
+     * VCPU and virtual LPI number to inject into.
+     */
+    union host_lpi **host_lpis;
+    /*
+     * Number of physical LPIs the host supports. This is a property of
+     * the GIC hardware. We depart from the habit of naming these things
+     * "physical" in Xen, as the GICv3/4 spec uses the term "physical LPI"
+     * in a different context to differentiate them from "virtual LPIs".
+     */
+    unsigned long int max_host_lpi_ids;
+    /*
+     * Protects allocation and deallocation of host LPIs and next_free_lpi,
+     * but not the actual data stored in the host_lpi entry.
+     */
+    spinlock_t host_lpis_lock;
+    uint32_t next_free_lpi;
+    unsigned int flags;
+};
+extern struct __lpi_data lpi_data;
+
 extern struct list_head host_its_list;
 
 int its_send_cmd_inv(struct host_its *its, uint32_t deviceid, uint32_t 
eventid);
@@ -223,6 +248,8 @@ struct pending_irq *gicv3_assign_guest_event(struct domain 
*d,
                                              uint32_t virt_lpi);
 void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id,
                                  uint32_t virt_lpi);
+void lpi_write_config(uint8_t *prop_table, uint32_t lpi, uint8_t clr,
+                      uint8_t set);
 int its_send_command(struct host_its *hw_its, const void *its_cmd);
 
 struct its_device *get_its_device(struct domain *d, paddr_t vdoorbell,
-- 
2.51.2



 


Rackspace

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