Make struct its_device and its commands sending methods publicly
available so they can be used by GICv4 implementation.

Signed-off-by: Mykyta Poturai <[email protected]>
---
 xen/arch/arm/gic-v3-its.c             | 30 +++++----------------------
 xen/arch/arm/include/asm/gic_v3_its.h | 29 ++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 34833166ad..25c07eb861 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -30,26 +30,6 @@
  */
 LIST_HEAD(host_its_list);
 
-/*
- * Describes a device which is using the ITS and is used by a guest.
- * Since device IDs are per ITS (in contrast to vLPIs, which are per
- * guest), we have to differentiate between different virtual ITSes.
- * We use the doorbell address here, since this is a nice architectural
- * property of MSIs in general and we can easily get to the base address
- * of the ITS and look that up.
- */
-struct its_device {
-    struct rb_node rbnode;
-    struct host_its *hw_its;
-    void *itt_addr;
-    unsigned int itt_order;
-    paddr_t guest_doorbell;             /* Identifies the virtual ITS */
-    uint32_t host_devid;
-    uint32_t guest_devid;
-    uint32_t eventids;                  /* Number of event IDs (MSIs) */
-    uint32_t *host_lpi_blocks;          /* Which LPIs are used on the host */
-    struct pending_irq *pend_irqs;      /* One struct per event */
-};
 
 /*
  * It is unlikely that a platform implements ITSes with different quirks,
@@ -155,7 +135,7 @@ bool gicv3_its_host_has_its(void)
 }
 
 #define BUFPTR_MASK                     GENMASK(19, 5)
-static int its_send_command(struct host_its *hw_its, const void *its_cmd)
+int its_send_command(struct host_its *hw_its, const void *its_cmd)
 {
     /*
      * The command queue should actually never become full, if it does anyway
@@ -258,7 +238,7 @@ static uint64_t encode_rdbase(struct host_its *hw_its, 
unsigned int cpu,
     return reg;
 }
 
-static int its_send_cmd_sync(struct host_its *its, unsigned int cpu)
+int its_send_cmd_sync(struct host_its *its, unsigned int cpu)
 {
     uint64_t cmd[4];
 
@@ -270,7 +250,7 @@ static int its_send_cmd_sync(struct host_its *its, unsigned 
int cpu)
     return its_send_command(its, cmd);
 }
 
-static int its_send_cmd_mapti(struct host_its *its,
+int its_send_cmd_mapti(struct host_its *its,
                               uint32_t deviceid, uint32_t eventid,
                               uint32_t pintid, uint16_t icid)
 {
@@ -322,7 +302,7 @@ static int its_send_cmd_mapd(struct host_its *its, uint32_t 
deviceid,
     return its_send_command(its, cmd);
 }
 
-static int its_send_cmd_inv(struct host_its *its,
+int its_send_cmd_inv(struct host_its *its,
                             uint32_t deviceid, uint32_t eventid)
 {
     uint64_t cmd[4];
@@ -897,7 +877,7 @@ out:
 }
 
 /* Must be called with the its_device_lock held. */
-static struct its_device *get_its_device(struct domain *d, paddr_t vdoorbell,
+struct its_device *get_its_device(struct domain *d, paddr_t vdoorbell,
                                          uint32_t vdevid)
 {
     struct rb_node *node = d->arch.vgic.its_devices.rb_node;
diff --git a/xen/arch/arm/include/asm/gic_v3_its.h 
b/xen/arch/arm/include/asm/gic_v3_its.h
index fc5a84892c..aa54e9a364 100644
--- a/xen/arch/arm/include/asm/gic_v3_its.h
+++ b/xen/arch/arm/include/asm/gic_v3_its.h
@@ -116,6 +116,27 @@
 /* We allocate LPIs on the hosts in chunks of 32 to reduce handling overhead. 
*/
 #define LPI_BLOCK                       32U
 
+/*
+ * Describes a device which is using the ITS and is used by a guest.
+ * Since device IDs are per ITS (in contrast to vLPIs, which are per
+ * guest), we have to differentiate between different virtual ITSes.
+ * We use the doorbell address here, since this is a nice architectural
+ * property of MSIs in general and we can easily get to the base address
+ * of the ITS and look that up.
+ */
+struct its_device {
+    struct rb_node rbnode;
+    struct host_its *hw_its;
+    unsigned int itt_order;
+    void *itt_addr;
+    paddr_t guest_doorbell;             /* Identifies the virtual ITS */
+    uint32_t host_devid;
+    uint32_t guest_devid;
+    uint32_t eventids;                  /* Number of event IDs (MSIs) */
+    uint32_t *host_lpi_blocks;          /* Which LPIs are used on the host */
+    struct pending_irq *pend_irqs;      /* One struct per event */
+};
+
 /* data structure for each hardware ITS */
 struct host_its {
     struct list_head entry;
@@ -138,6 +159,10 @@ int gicv3_its_setup_collection(unsigned int cpu);
 
 extern struct list_head host_its_list;
 
+int its_send_cmd_inv(struct host_its *its, uint32_t deviceid, uint32_t 
eventid);
+int its_send_cmd_clear(struct host_its *its, uint32_t deviceid, uint32_t 
eventid);
+int its_send_cmd_mapti(struct host_its *its, uint32_t deviceid,
+                       uint32_t eventid, uint32_t pintid, uint16_t icid);
 #ifdef CONFIG_ACPI
 unsigned long gicv3_its_make_hwdom_madt(const struct domain *d,
                                         void *base_ptr);
@@ -198,6 +223,10 @@ 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);
+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,
+                                  uint32_t vdevid);
 
 /* ITS quirks handling. */
 uint64_t gicv3_its_get_cacheability(void);
-- 
2.51.2

Reply via email to