All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [RFC][PATCH] KVM: Introduce direct MSI message injection for in-kernel irqchips
Date: Fri, 21 Oct 2011 11:42:13 +0200	[thread overview]
Message-ID: <1319190133.31522.28.camel@lappy> (raw)
In-Reply-To: <4EA13917.7070401@siemens.com>

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.kiszka@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.


  reply	other threads:[~2011-10-21  9:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-21  9:19 [RFC][PATCH] KVM: Introduce direct MSI message injection for in-kernel irqchips Jan Kiszka
2011-10-21  9:42 ` Sasha Levin [this message]
2011-10-21 11:06 ` Michael S. Tsirkin
2011-10-21 11:51   ` Jan Kiszka
2011-10-21 12:04     ` Michael S. Tsirkin
2011-10-21 13:00       ` Jan Kiszka
2011-10-24  9:45 ` Avi Kivity
2011-10-24 10:19   ` Jan Kiszka
2011-10-24 11:09     ` Avi Kivity
2011-10-24 12:06       ` Jan Kiszka
2011-10-24 12:43         ` Michael S. Tsirkin
2011-10-24 13:11           ` Jan Kiszka
2011-10-24 13:43             ` Jan Kiszka
2011-10-24 14:40               ` Michael S. Tsirkin
2011-10-24 15:00                 ` Jan Kiszka
2011-10-24 16:05                   ` Michael S. Tsirkin
2011-10-24 16:10                     ` Jan Kiszka
2011-10-24 17:05                       ` Michael S. Tsirkin
2011-10-24 17:23                         ` Michael S. Tsirkin
2011-10-25  7:24                           ` Jan Kiszka
2011-10-25 11:20                             ` Michael S. Tsirkin
2011-10-25 11:41                               ` Jan Kiszka
2011-10-25 12:05                                 ` Michael S. Tsirkin
2011-10-25 12:21                                   ` Jan Kiszka
2011-10-25 13:29                                     ` Michael S. Tsirkin
2011-10-24 14:25             ` Michael S. Tsirkin
2011-10-25  7:56         ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1319190133.31522.28.camel@lappy \
    --to=levinsasha928@gmail.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.