Skip to contentSkip to conversation

xen: arm: allow platform code to select dom0 event channel irq

PATCH Superseded Ian Campbell 3 participants 3 messages Nov 22, 2013

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 5/15 xen: arm: allow platform code to select dom0 event channel irq

Currently the hardcoded use of GUEST_EVTCHN_PPI is problematic if that is a real PPI on the platform.

We really need to be smarter about selecting an unused PPI but in the meantime we can at least give the platform code the option of hardcoding a number which works for the platform.

Hardcode a suitable PPI on the Xgene platform.

---
 xen/arch/arm/domain.c                |    7 +++++--
 xen/arch/arm/platform.c              |    7 +++++++
 xen/arch/arm/platforms/xgene-storm.c |    1 +
 xen/include/asm-arm/platform.h       |    5 +++++
 4 files changed, 18 insertions(+), 2 deletions(-)
xen/arch/arm/domain.c +5 -2
index 2f57d01..52d2403 100644
@@ -31,6 +31,7 @@
 #include <asm/processor-ca15.h>
 
 #include <asm/gic.h>
+#include <asm/platform.h>
 #include "vtimer.h"
 #include "vuart.h"
 
@@ -526,8 +527,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
     if ( (rc = vcpu_domain_init(d)) != 0 )
         goto fail;
 
-    /* XXX dom0 needs more intelligent selection of PPI */
-    d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
+    if ( d->domain_id )
+        d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
+    else
+        d->arch.evtchn_irq = platform_dom0_evtchn_ppi();
 
     /*
      * Virtual UART is only used by linux early printk and decompress code.
xen/arch/arm/platform.c +7 -0
index 0fbbdc7..a7f9ee4 100644
@@ -156,6 +156,13 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node)
     return dt_match_node(blacklist, node);
 }
 
+unsigned int platform_dom0_evtchn_ppi(void)
+{
+    if ( platform && platform->dom0_evtchn_ppi )
+        return platform->dom0_evtchn_ppi;
+    return GUEST_EVTCHN_PPI;
+}
+
 /*
  * Local variables:
  * mode: C
xen/arch/arm/platforms/xgene-storm.c +1 -0
index d185a4a..8658996 100644
@@ -40,6 +40,7 @@ static const char const *xgene_storm_dt_compat[] __initdata =
 PLATFORM_START(xgene_storm, "APM X-GENE STORM")
     .compatible = xgene_storm_dt_compat,
     .quirks = xgene_storm_quirks,
+    .dom0_evtchn_ppi = 24,
 PLATFORM_END
 
 /*
xen/include/asm-arm/platform.h +5 -0
index c9314e5..5900ee4 100644
@@ -37,6 +37,10 @@ struct platform_desc {
      * List of devices which must not pass-through to a guest
      */
     const struct dt_device_match *blacklist_dev;
+    /*
+     * The IRQ (PPI) to use to inject event channels to dom0.
+     */
+    unsigned int dom0_evtchn_ppi;
 };
 
 /*
@@ -61,6 +65,7 @@ void platform_reset(void);
 void platform_poweroff(void);
 bool_t platform_has_quirk(uint32_t quirk);
 bool_t platform_device_is_blacklisted(const struct dt_device_node *node);
+unsigned int platform_dom0_evtchn_ppi(void);
 
 #define PLATFORM_START(_name, _namestr)                         \
 static const struct platform_desc  __plat_desc_##_name __used   \
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 11 lines · Ian Campbell

Currently the hardcoded use of GUEST_EVTCHN_PPI is problematic if that is a real PPI on the platform.

We really need to be smarter about selecting an unused PPI but in the meantime we can at least give the platform code the option of hardcoding a number which works for the platform.

Hardcode a suitable PPI on the Xgene platform.

Quoted 93 lines
---
 xen/arch/arm/domain.c                |    7 +++++--
 xen/arch/arm/platform.c              |    7 +++++++
 xen/arch/arm/platforms/xgene-storm.c |    1 +
 xen/include/asm-arm/platform.h       |    5 +++++
 4 files changed, 18 insertions(+), 2 deletions(-)
xen/arch/arm/domain.c +5 -2
index 2f57d01..52d2403 100644
@@ -31,6 +31,7 @@
 #include <asm/processor-ca15.h>
 
 #include <asm/gic.h>
+#include <asm/platform.h>
 #include "vtimer.h"
 #include "vuart.h"
 
@@ -526,8 +527,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
     if ( (rc = vcpu_domain_init(d)) != 0 )
         goto fail;
 
-    /* XXX dom0 needs more intelligent selection of PPI */
-    d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
+    if ( d->domain_id )
+        d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
+    else
+        d->arch.evtchn_irq = platform_dom0_evtchn_ppi();
 
     /*
      * Virtual UART is only used by linux early printk and decompress code.
xen/arch/arm/platform.c +7 -0
index 0fbbdc7..a7f9ee4 100644
@@ -156,6 +156,13 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node)
     return dt_match_node(blacklist, node);
 }
 
+unsigned int platform_dom0_evtchn_ppi(void)
+{
+    if ( platform && platform->dom0_evtchn_ppi )
+        return platform->dom0_evtchn_ppi;
+    return GUEST_EVTCHN_PPI;
+}
+
 /*
  * Local variables:
  * mode: C
xen/arch/arm/platforms/xgene-storm.c +1 -0
index d185a4a..8658996 100644
@@ -40,6 +40,7 @@ static const char const *xgene_storm_dt_compat[] __initdata =
 PLATFORM_START(xgene_storm, "APM X-GENE STORM")
     .compatible = xgene_storm_dt_compat,
     .quirks = xgene_storm_quirks,
+    .dom0_evtchn_ppi = 24,
 PLATFORM_END
 
 /*
xen/include/asm-arm/platform.h +5 -1
index c9314e5..5900ee4 100644
@@ -37,6 +37,10 @@ struct platform_desc {
      * List of devices which must not pass-through to a guest
      */
     const struct dt_device_match *blacklist_dev;
+    /*
+     * The IRQ (PPI) to use to inject event channels to dom0.
+     */
+    unsigned int dom0_evtchn_ppi;
 };
 
 /*
@@ -61,6 +65,7 @@ void platform_reset(void);
 void platform_poweroff(void);
 bool_t platform_has_quirk(uint32_t quirk);
 bool_t platform_device_is_blacklisted(const struct dt_device_node *node);
+unsigned int platform_dom0_evtchn_ppi(void);
 
 #define PLATFORM_START(_name, _namestr)                         \
 static const struct platform_desc  __plat_desc_##_name __used   \
--

1.7.10.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v2 5/15
#2 lore raw
In reply to Ian Campbell
Quoted 11 lines · Ian Campbell

Currently the hardcoded use of GUEST_EVTCHN_PPI is problematic if that is a real PPI on the platform.

We really need to be smarter about selecting an unused PPI but in the meantime we can at least give the platform code the option of hardcoding a number which works for the platform.

Hardcode a suitable PPI on the Xgene platform.

I have a patch somewhere to find a free PPI, I forget to rework it... and it's a bit invasive for 4.4.

Quoted 86 lines
---
  xen/arch/arm/domain.c                |    7 +++++--
  xen/arch/arm/platform.c              |    7 +++++++
  xen/arch/arm/platforms/xgene-storm.c |    1 +
  xen/include/asm-arm/platform.h       |    5 +++++
  4 files changed, 18 insertions(+), 2 deletions(-)
xen/arch/arm/domain.c +5 -2
index 2f57d01..52d2403 100644
@@ -31,6 +31,7 @@
  #include <asm/processor-ca15.h>
 
  #include <asm/gic.h>
+#include <asm/platform.h>
  #include "vtimer.h"
  #include "vuart.h"
 
@@ -526,8 +527,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
      if ( (rc = vcpu_domain_init(d)) != 0 )
          goto fail;
 
-    /* XXX dom0 needs more intelligent selection of PPI */
-    d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
+    if ( d->domain_id )
+        d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
+    else
+        d->arch.evtchn_irq = platform_dom0_evtchn_ppi();
 
      /*
       * Virtual UART is only used by linux early printk and decompress code.
xen/arch/arm/platform.c +7 -0
index 0fbbdc7..a7f9ee4 100644
@@ -156,6 +156,13 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node)
      return dt_match_node(blacklist, node);
  }
 
+unsigned int platform_dom0_evtchn_ppi(void)
+{
+    if ( platform && platform->dom0_evtchn_ppi )
+        return platform->dom0_evtchn_ppi;
+    return GUEST_EVTCHN_PPI;
+}
+
  /*
   * Local variables:
   * mode: C
xen/arch/arm/platforms/xgene-storm.c +1 -0
index d185a4a..8658996 100644
@@ -40,6 +40,7 @@ static const char const *xgene_storm_dt_compat[] __initdata =
  PLATFORM_START(xgene_storm, "APM X-GENE STORM")
      .compatible = xgene_storm_dt_compat,
      .quirks = xgene_storm_quirks,
+    .dom0_evtchn_ppi = 24,
  PLATFORM_END
 
  /*
xen/include/asm-arm/platform.h +5 -0
index c9314e5..5900ee4 100644
@@ -37,6 +37,10 @@ struct platform_desc {
       * List of devices which must not pass-through to a guest
       */
      const struct dt_device_match *blacklist_dev;
+    /*
+     * The IRQ (PPI) to use to inject event channels to dom0.
+     */
+    unsigned int dom0_evtchn_ppi;
  };
 
  /*
@@ -61,6 +65,7 @@ void platform_reset(void);
  void platform_poweroff(void);
  bool_t platform_has_quirk(uint32_t quirk);
  bool_t platform_device_is_blacklisted(const struct dt_device_node *node);
+unsigned int platform_dom0_evtchn_ppi(void);
 
  #define PLATFORM_START(_name, _namestr)                         \
  static const struct platform_desc  __plat_desc_##_name __used   \
Signature · 1 line
Julien Grall