All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] public/hvm: Export the HVM_PARAM_CALLBACK_VIA ABI in the API
@ 2015-11-20 18:20 Andrew Cooper
  2015-11-24  7:33 ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cooper @ 2015-11-20 18:20 UTC (permalink / raw)
  To: Xen-devel
  Cc: Keir Fraser, Ian Campbell, Andrew Cooper, Ian Jackson, Tim Deegan,
	Stefano Stabellini, Jan Beulich, Shannon Zhao

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@citrix.com>
CC: Shannon Zhao <zhaoshenglong@huawei.com>

---
This ABI is utterly mad.

Despite appearing to be wrong, it is compatible with its implementation of

    enum {
        HVMIRQ_callback_none,
        HVMIRQ_callback_gsi,
        HVMIRQ_callback_pci_intx,
        HVMIRQ_callback_vector
    } callback_via_type;

Because of a sneaky:

    via_type = (uint8_t)(via >> 56) + 1;
    if ( ((via_type == HVMIRQ_callback_gsi) && (via == 0)) ||
         (via_type > HVMIRQ_callback_vector) )

I also observe:
 * GSI is actually clipped at 8 bits, rather than the documented 55
 * Attempting to use GSI 0 will actually disable callbacks
 * Xen currently ignores DOMAIN and FUNCTION from PCI_INTX.  As this has been
   broken for a very long time, it probably can't be fixed without breaking
   something else.

but lack sufficient time to fix these issues at the moment.
---
 xen/include/public/hvm/params.h | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h
index 356dfd3..fc4cdca 100644
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -29,18 +29,21 @@
  * Parameter space for HVMOP_{set,get}_param.
  */
 
+#define HVM_PARAM_CALLBACK_IRQ 0
+
 /*
  * How should CPU0 event-channel notifications be delivered?
- * val[63:56] == 0: val[55:0] is a delivery GSI (Global System Interrupt).
- * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows:
- *                  Domain = val[47:32], Bus  = val[31:16],
- *                  DevFn  = val[15: 8], IntX = val[ 1: 0]
- * val[63:56] == 2: val[7:0] is a vector number, check for
- *                  XENFEAT_hvm_callback_vector to know if this delivery
- *                  method is available.
+ *
  * If val == 0 then CPU0 event-channel notifications are not delivered.
+ * If val != 0, val[63:56] encodes the type, as follows:
  */
-#define HVM_PARAM_CALLBACK_IRQ 0
+#define HVM_PARAM_CALLBACK_TYPE_GSI      0 /* val[55:0] is a delivery GSI */
+#define HVM_PARAM_CALLBACK_TYPE_PCI_INTX 1 /* val[55:0] is a delivery PCI INTx line:
+                                              Domain = val[47:32], Bus  = val[31:16],
+                                              DevFn  = val[15: 8], IntX = val[ 1: 0] */
+#define HVM_PARAM_CALLBACK_TYPE_VECTOR   2 /* val[7:0] is a vector number, check for
+                                              XENFEAT_hvm_callback_vector to know if
+                                              this delivery method is available. */
 
 /*
  * These are not used by Xen. They are here for convenience of HVM-guest
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH] public/hvm: Export the HVM_PARAM_CALLBACK_VIA ABI in the API
@ 2015-12-10 20:15 Andrew Cooper
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Cooper @ 2015-12-10 20:15 UTC (permalink / raw)
  To: Xen-devel
  Cc: Keir Fraser, Ian Campbell, Andrew Cooper, Ian Jackson, Tim Deegan,
	Stefano Stabellini, Jan Beulich, Shannon Zhao

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@citrix.com>
CC: Shannon Zhao <zhaoshenglong@huawei.com>

v2: Reformat the comments, and note that GSI 0 cannot be used.
---
This ABI is utterly mad.

Despite appearing to be wrong, it is compatible with its implementation of

    enum {
        HVMIRQ_callback_none,
        HVMIRQ_callback_gsi,
        HVMIRQ_callback_pci_intx,
        HVMIRQ_callback_vector
    } callback_via_type;

Because of a sneaky:

    via_type = (uint8_t)(via >> 56) + 1;
    if ( ((via_type == HVMIRQ_callback_gsi) && (via == 0)) ||
         (via_type > HVMIRQ_callback_vector) )

I also observe:
 * GSI is actually clipped at 8 bits, rather than the documented 55
 * Xen currently ignores DOMAIN and FUNCTION from PCI_INTX.  As this has been
   broken for a very long time, it probably can't be fixed without breaking
   something else.

but lack sufficient time to fix these issues at the moment.
---
 xen/include/public/hvm/params.h | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h
index b437444..81f9451 100644
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -29,18 +29,31 @@
  * Parameter space for HVMOP_{set,get}_param.
  */
 
+#define HVM_PARAM_CALLBACK_IRQ 0
 /*
  * How should CPU0 event-channel notifications be delivered?
- * val[63:56] == 0: val[55:0] is a delivery GSI (Global System Interrupt).
- * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows:
- *                  Domain = val[47:32], Bus  = val[31:16],
- *                  DevFn  = val[15: 8], IntX = val[ 1: 0]
- * val[63:56] == 2: val[7:0] is a vector number, check for
- *                  XENFEAT_hvm_callback_vector to know if this delivery
- *                  method is available.
+ *
  * If val == 0 then CPU0 event-channel notifications are not delivered.
+ * If val != 0, val[63:56] encodes the type, as follows:
+ */
+
+#define HVM_PARAM_CALLBACK_TYPE_GSI      0
+/*
+ * val[55:0] is a delivery GSI.  GSI 0 cannot be used, as it aliases val == 0,
+ * and disables all notifications.
+ */
+
+#define HVM_PARAM_CALLBACK_TYPE_PCI_INTX 1
+/*
+ * val[55:0] is a delivery PCI INTx line:
+ * Domain = val[47:32], Bus = val[31:16] DevFn = val[15:8], IntX = val[1:0]
+ */
+
+#define HVM_PARAM_CALLBACK_TYPE_VECTOR   2
+/*
+ * val[7:0] is a vector number.  Check for XENFEAT_hvm_callback_vector to know
+ * if this delivery method is available.
  */
-#define HVM_PARAM_CALLBACK_IRQ 0
 
 /*
  * These are not used by Xen. They are here for convenience of HVM-guest
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-10 20:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-20 18:20 [PATCH] public/hvm: Export the HVM_PARAM_CALLBACK_VIA ABI in the API Andrew Cooper
2015-11-24  7:33 ` Jan Beulich
2015-11-24  9:56   ` Paul Durrant
2015-11-24 10:28     ` Andrew Cooper
2015-11-24 10:36       ` George Dunlap
2015-11-24 11:14       ` Paul Durrant
  -- strict thread matches above, loose matches on Subject: below --
2015-12-10 20:15 Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.