virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Carsten Otte <cotte@de.ibm.com>,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [PATCH RFC 0/2] qemu-kvm: MSI-X support
Date: Wed, 13 May 2009 10:17:17 +0300	[thread overview]
Message-ID: <4A0A73FD.4030002@redhat.com> (raw)
In-Reply-To: <20090512134521.GC23796@redhat.com>

Michael S. Tsirkin wrote:
> It seems that if I just call apic_deliver_irq each time
> I want to send MSI, things will work.
>
> However, large part of the msix code is managing IRQs versus kernel,
> and I'm not sure it's a wise investment of effort to rip it all out. So
> IMHO, what's missing is API that abstracts managing irq routes in kvm,
> specifically abstract this stuff in some way:
> 	kvm_get_irq_route_gsi
> 	kvm_add_routing_entry
> 	kvm_del_routing_entry
> 	kvm_commit_irq_routes
>   

All these are just games with qemu_irq objects.  Should be a lot simpler 
in userspace.


> 	kvm_set_irq
>   

qemu_set_irq().

> How hard is that?
>   

Should be pretty easy, once you get the hang of qemu_irq.

> For now, this API could be a stub that just stores the routes somewhere,
> and set_irq would call the local apic emulation, along the lines of:
>
> 	uint8_t dest = (addr_lo & MSI_ADDR_DEST_ID_MASK)
> 		>> MSI_ADDR_DEST_ID_SHIFT;
> 	uint8_t vector = (addr_hi & MSI_DATA_VECTOR_MASK)
> 		>> MSI_DATA_VECTOR_SHIFT;
> 	uint8_t dest_mode = (addr_lo >> MSI_ADDR_DEST_MODE_SHIFT) & 0x1;
> 	uint8_t trigger_mode = (data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
> 	uint8_t delivery_mode = (data >> MSI_DATA_DELIVERY_MODE_SHIFT) &
> 		0x7;
> 	apic_deliver_irq(dest, dest_mode, delivery_mode, vector, 0,
> 			 trigger_mode);
>   

qemu_set_irq() eventually calls a callback that you specify; just set it 
do look up the entry and call apic_deliver_irq.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

  parent reply	other threads:[~2009-05-13  7:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090511221350.GA22776@redhat.com>
2009-05-11 22:24 ` [PATCH RFC 0/2] qemu-kvm: MSI-X support Anthony Liguori
     [not found] ` <4A08A599.1070708@codemonkey.ws>
2009-05-12 13:45   ` Michael S. Tsirkin
     [not found]   ` <20090512134521.GC23796@redhat.com>
2009-05-13  7:17     ` Avi Kivity [this message]
2009-05-11 22:13 Michael S. Tsirkin

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=4A0A73FD.4030002@redhat.com \
    --to=avi@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=borntraeger@de.ibm.com \
    --cc=cotte@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).