public/hvm: Export the HVM_PARAM_CALLBACK_VIA ABI in the API
PATCH 1/1 public/hvm: Export the HVM_PARAM_CALLBACK_VIA ABI in the API
---
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(-)
xen/include/public/hvm/params.h +11 -8
@@ -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
Signature · 1 line
2.1.4
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 20.11.15 at 19:20, <[email protected]> wrote:
xen/include/public/hvm/params.h +3
-7@@ -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.
xen/include/public/hvm/params.h line 46
Quoted 10 lines
xen/include/public/hvm/params.h +8
-1+* 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. */
Would you not think that while cleaning this up, doing some re-formatting would also help? I.e. Putting the comments on lines of their own instead of at the end (even more deeply indented than they were before)? Also the first two of these last three comments are missing full stops.
Also considering
* Attempting to use GSI 0 will actually disable callbacks
in your patch comments, I'd suggest extending the GSI comment to state that it has to be a non-zero one.
Jan
Quoted 50 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Jan Beulich
Sent: 24 November 2015 07:33
To: Andrew Cooper
Cc: Keir (Xen.org); Ian Campbell; Tim (Xen.org); Ian Jackson; Xen-devel; Stefano Stabellini; Shannon Zhao
Subject: Re: [Xen-devel] [PATCH] public/hvm: Export theHVM_PARAM_CALLBACK_VIAABI in the APIQuoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.11.15 at 19:20, <[email protected]> wrote:
xen/include/public/hvm/params.h +2
-3@@ -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], xen/include/public/hvm/params.h line 40
Quoted 10 lines
xen/include/public/hvm/params.h +3
-5-* 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 */
xen/include/public/hvm/params.h line 41
Quoted 1 line
xen/include/public/hvm/params.h +1
-0+#define HVM_PARAM_CALLBACK_TYPE_PCI_INTX 1/* val[55:0] is a delivery PCI INTx line:
xen/include/public/hvm/params.h
Quoted 3 lines
xen/include/public/hvm/params.h +3
-0+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
xen/include/public/hvm/params.h line 46
Quoted 2 lines
xen/include/public/hvm/params.h +2
-0+XENFEAT_hvm_callback_vector to know if +this delivery method is available. */ Would you not think that while cleaning this up, doing some re-formatting would also help? I.e. Putting the comments on lines of their own instead of at the end (even more deeply indented than they were before)? Also the first two of these last three comments are missing full stops.
Quoted 7 lines
Also considering
* Attempting to use GSI 0 will actually disable callbacks
in your patch comments, I'd suggest extending the GSI comment to state that it has to be a non-zero one.
Could we also perhaps deprecate this whole mechanism at this point? I added HVMOP_set_evtchn_upcall_vector quite a while ago now.
Paul
Quoted 7 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 49 lines · Paul Durrant
Quoted 49 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Jan Beulich
Sent: 24 November 2015 07:33
To: Andrew Cooper
Cc: Keir (Xen.org); Ian Campbell; Tim (Xen.org); Ian Jackson; Xen-devel; Stefano Stabellini; Shannon Zhao
Subject: Re: [Xen-devel] [PATCH] public/hvm: Export theHVM_PARAM_CALLBACK_VIAABI in the APIQuoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.11.15 at 19:20, <[email protected]> wrote:
xen/include/public/hvm/params.h +2
-3@@ -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], xen/include/public/hvm/params.h line 40
Quoted 10 lines
xen/include/public/hvm/params.h +3
-5-* 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 */
xen/include/public/hvm/params.h line 41
Quoted 1 line
xen/include/public/hvm/params.h +1
-0+#define HVM_PARAM_CALLBACK_TYPE_PCI_INTX 1/* val[55:0] is a delivery PCI INTx line:
xen/include/public/hvm/params.h
Quoted 3 lines
xen/include/public/hvm/params.h +3
-0+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
xen/include/public/hvm/params.h line 46
Quoted 2 lines
xen/include/public/hvm/params.h +2
-0+XENFEAT_hvm_callback_vector to know if +this delivery method is available. */ Would you not think that while cleaning this up, doing some re-formatting would also help? I.e. Putting the comments on lines of their own instead of at the end (even more deeply indented than they were before)? Also the first two of these last three comments are missing full stops.
Quoted 8 lines
Quoted 7 lines
Also considering
* Attempting to use GSI 0 will actually disable callbacks
in your patch comments, I'd suggest extending the GSI comment to state that it has to be a non-zero one.
Could we also perhaps deprecate this whole mechanism at this point? I added
HVMOP_set_evtchn_upcall_vectorquite a while ago now.
January, so Xen 4.6 is the only release with this hvmop in.
The issue with deprecating HVM_PARAM_CALLBACK_IRQ is that DMLite has no LAPIC, so can't use HVMOP_set_evtchn_upcall_vector.
Much as this ABI is horrible and nasty (and really should be deprecated), there are not alternatives which cover the common uses.
~Andrew
Quoted 3 lines · Andrew Cooper
Quoted 1 line
Could we also perhaps deprecate this whole mechanism at this point? I added
HVMOP_set_evtchn_upcall_vectorquite a while ago now.January, so Xen 4.6 is the only release with this hvmop in.
Come on -- if you're not rebuilding from master every week, you're basically in the dark ages. ;-)
-George
Quoted 71 lines
-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: 24 November 2015 10:29
To: Paul Durrant; Jan Beulich
Cc: Keir (Xen.org); Ian Campbell; Tim (Xen.org); Ian Jackson; Xen-devel; Stefano Stabellini; Shannon Zhao
Subject: Re: [Xen-devel] [PATCH] public/hvm: Export theHVM_PARAM_CALLBACK_VIAABI in the APIQuoted 26 lines · Paul Durrant
Quoted 26 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Jan Beulich
Sent: 24 November 2015 07:33
To: Andrew Cooper
Cc: Keir (Xen.org); Ian Campbell; Tim (Xen.org); Ian Jackson; Xen-devel; Stefano Stabellini; Shannon Zhao
Subject: Re: [Xen-devel] [PATCH] public/hvm: Export theHVM_PARAM_CALLBACK_VIAABI in the APIQuoted 16 lines
Quoted 1 line
Quoted 1 line · On 20.11.15 at 19:20, <[email protected]> wrote:
xen/include/public/hvm/params.h +2
-5@@ -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 Quoted 8 lines
Quoted 8 lines
xen/include/public/hvm/params.h
Quoted 8 lines
xen/include/public/hvm/params.h +3
-3-* 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
Quoted 6 lines
Quoted 6 lines
GSI */
xen/include/public/hvm/params.h line 41
Quoted 1 line
xen/include/public/hvm/params.h +1
-0+#define HVM_PARAM_CALLBACK_TYPE_PCI_INTX 1/* val[55:0] is a delivery PCI INTx line:
Quoted 3 lines
xen/include/public/hvm/params.h +3
-0+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
Quoted 9 lines
Quoted 9 lines
number, check for
xen/include/public/hvm/params.h line 46
Quoted 2 lines
xen/include/public/hvm/params.h +2
-0+XENFEAT_hvm_callback_vector to know if +this delivery method is available. */ Would you not think that while cleaning this up, doing some re-formatting would also help? I.e. Putting the comments on lines of their own instead of at the end (even more deeply indented than they were before)? Also the first two of these last three comments are missing full stops.
Quoted 8 lines
Quoted 7 lines
Also considering
* Attempting to use GSI 0 will actually disable callbacks
in your patch comments, I'd suggest extending the GSI comment to state that it has to be a non-zero one.
Could we also perhaps deprecate this whole mechanism at this point? I
added
HVMOP_set_evtchn_upcall_vectorquite a while ago now.
Quoted 9 lines
January, so Xen 4.6 is the only release with this hvmop in.
The issue with deprecating
HVM_PARAM_CALLBACK_IRQis that DMLite has no
LAPIC, so can't useHVMOP_set_evtchn_upcall_vector.Much as this ABI is horrible and nasty (and really should be deprecated), there are not alternatives which cover the common uses.
Yes, I realise the lack of LAPIC means that the HVMOP can't be used in that case, but I really really think that a new hypercall would be preferable to perpetuating the use of the callback_vector type with this param.
Paul
Quoted 1 line
~Andrew