|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86: Update HVM_PARAM_CALLBACK_IRQ
On Mon, Feb 29, 2016 at 03:39:36PM -0500, Konrad Rzeszutek Wilk wrote:
> Couple of updates:
> - Add an macro to make it easier to use the vector callback.
>
> - Fix the odditity in Xen internal usage of an enum which offset
> by one compared to the #defines. Make it the same.
>
> - This also clears up the printing of the Callback in the
> irq_dump() to match up with the #defines.
>
> Reported-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
CC-ing Stefano.
> ---
> xen/arch/x86/hvm/irq.c | 2 +-
> xen/include/asm-x86/hvm/irq.h | 12 ++++++++----
> xen/include/public/hvm/hvm_op.h | 3 ++-
> xen/include/public/hvm/params.h | 15 +++++++++++++++
> 4 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
> index 5323d7c..0c6ead4 100644
> --- a/xen/arch/x86/hvm/irq.c
> +++ b/xen/arch/x86/hvm/irq.c
> @@ -325,7 +325,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
> unsigned int gsi=0, pdev=0, pintx=0;
> uint8_t via_type;
>
> - via_type = (uint8_t)(via >> 56) + 1;
> + via_type = (uint8_t)(via >> HVM_PARAM_CALLBACK_TYPE_SHIFT);
> if ( ((via_type == HVMIRQ_callback_gsi) && (via == 0)) ||
> (via_type > HVMIRQ_callback_vector) )
> via_type = HVMIRQ_callback_none;
> diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
> index 73b8fb0..2a301db 100644
> --- a/xen/include/asm-x86/hvm/irq.h
> +++ b/xen/include/asm-x86/hvm/irq.h
> @@ -26,6 +26,8 @@
> #include <asm/hvm/vpic.h>
> #include <asm/hvm/vioapic.h>
>
> +#include <public/hvm/params.h>
> +
> struct hvm_irq {
> /*
> * Virtual interrupt wires for a single PCI bus.
> @@ -50,11 +52,13 @@ struct hvm_irq {
> /* Virtual interrupt and via-link for paravirtual platform driver. */
> uint32_t callback_via_asserted;
> union {
> + /* These MUST match with HVM_PARAM_CALLBACK_IRQ types. */
> enum {
> - HVMIRQ_callback_none,
> - HVMIRQ_callback_gsi,
> - HVMIRQ_callback_pci_intx,
> - HVMIRQ_callback_vector
> + HVMIRQ_callback_gsi = HVM_PARAM_CALLBACK_TYPE_GSI,
> + HVMIRQ_callback_pci_intx = HVM_PARAM_CALLBACK_TYPE_PCI_INTX,
> + HVMIRQ_callback_vector = HVM_PARAM_CALLBACK_TYPE_VECTOR,
> + /* Will change if we add more types. */
> + HVMIRQ_callback_none = HVM_PARAM_CALLBACK_TYPE_NUM,
> } callback_via_type;
> };
> union {
> diff --git a/xen/include/public/hvm/hvm_op.h b/xen/include/public/hvm/hvm_op.h
> index 1606185..5908f39 100644
> --- a/xen/include/public/hvm/hvm_op.h
> +++ b/xen/include/public/hvm/hvm_op.h
> @@ -386,7 +386,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t);
> * channel upcalls on the specified <vcpu>.
> If set,
> * this vector will be used in preference to
> the
> * domain global callback via (see
> - * HVM_PARAM_CALLBACK_IRQ).
> + * HVM_PARAM_CALLBACK_IRQ and
> + * HVM_PARAM_CALLBACK_VECTOR).
> */
> #define HVMOP_set_evtchn_upcall_vector 23
> struct xen_hvm_evtchn_upcall_vector {
> diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h
> index 73d4718..5c7fbc5 100644
> --- a/xen/include/public/hvm/params.h
> +++ b/xen/include/public/hvm/params.h
> @@ -56,6 +56,21 @@
> */
>
> /*
> + * In the future this may change.
> + */
> +#define HVM_PARAM_CALLBACK_TYPE_NUM HVM_PARAM_CALLBACK_TYPE_VECTOR + 1
> +/*
> + * The val[63:56] convenience shift.
> + */
> +#define HVM_PARAM_CALLBACK_TYPE_SHIFT 56
> +
> +/*
> + * Wrapper around for HVM_PARAM_CALLBACK_TYPE_VECTOR.
> + */
> +#define HVM_PARAM_CALLBACK_VECTOR(x) \
> + (((uint64_t)HVM_PARAM_CALLBACK_TYPE_VECTOR) << \
> + HVM_PARAM_CALLBACK_TYPE_SHIFT | (x))
> +/*
> * These are not used by Xen. They are here for convenience of HVM-guest
> * xenbus implementations.
> */
> --
> 2.4.3
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |