On Fri, 2011-10-21 at 11:19 +0200, Jan Kiszka wrote:
> Currently, MSI messages can only be injected to in-kernel irqchips by
> defining a corresponding IRQ route for each message. This is not only
> unhandy if the MSI messages are generated "on the fly" by user space,
> IRQ routes are a limited resource that user space as to manage
> carefully.
> 
> By providing a direct injection with, we can both avoid using up limited
> resources and simplify the necessary steps for user land. The API
> already provides a channel (flags) to revoke an injected but not yet
> delivered message which will become important for in-kernel MSI-X vector
> masking support.
> 
> Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
> ---
>  Documentation/virtual/kvm/api.txt |   23 +++++++++++++++++++++++
>  include/linux/kvm.h               |   15 +++++++++++++++
>  virt/kvm/kvm_main.c               |   18 ++++++++++++++++++
>  3 files changed, 56 insertions(+), 0 deletions(-)
> 
> diff --git a/Documentation/virtual/kvm/api.txt 
> b/Documentation/virtual/kvm/api.txt
> index 7945b0b..f4c3de3 100644
> --- a/Documentation/virtual/kvm/api.txt
> +++ b/Documentation/virtual/kvm/api.txt
> @@ -1383,6 +1383,29 @@ The following flags are defined:
>  If datamatch flag is set, the event will be signaled only if the written 
> value
>  to the registered address is equal to datamatch in struct kvm_ioeventfd.
>  
> +4.59 KVM_SET_MSI
> +
> +Capability: KVM_CAP_SET_MSI
> +Architectures: x86 ia64
> +Type: vm ioctl
> +Parameters: struct kvm_msi (in)
> +Returns: 0 on success, -1 on error
> +
> +Directly inject a MSI message. Only valid with in-kernel irqchip that handles
> +MSI messages.
> +
> +struct kvm_msi {
> +     __u32 address_lo;
> +     __u32 address_hi;
> +     __u32 data;
> +     __u32 flags;
> +     __u8  pad[16];
> +};
> +
> +The following flags are defined:
> +
> +#define KVM_MSI_FLAG_RAISE     (1 << 0)
> +
>  4.62 KVM_CREATE_SPAPR_TCE
>  
>  Capability: KVM_CAP_SPAPR_TCE
> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> index 6884054..83875ed 100644
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -557,6 +557,9 @@ struct kvm_ppc_pvinfo {
>  #define KVM_CAP_PPC_HIOR 67
>  #define KVM_CAP_PPC_PAPR 68
>  #define KVM_CAP_S390_GMAP 71
> +#ifdef __KVM_HAVE_MSI
> +#define KVM_CAP_SET_MSI 72
> +#endif
>  
>  #ifdef KVM_CAP_IRQ_ROUTING
>  
> @@ -636,6 +639,16 @@ struct kvm_clock_data {
>       __u32 pad[9];
>  };
>  
> +#define KVM_MSI_FLAG_RAISE     (1 << 0)
> +
> +struct kvm_msi {
> +     __u32 address_lo;
> +     __u32 address_hi;
> +     __u32 data;
> +     __u32 flags;
> +     __u8  pad[16];
> +};
> +

How about defining it as:

struct kvm_msi {
        struct msi_msg msi;
        __u32 flags;
        __u8 pad[16];
};

It would allow keeping everything in a msi_msg all the way from
userspace up to kvm_set_msi()

-- 

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to