All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: David Kiarie <davidkiarie4@gmail.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Peter Maydell <peter.maydell@linaro.org>,
	Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"J. Kiszka" <jan.kiszka@siemens.com>,
	Valentine Sinitsyn <valentine.sinitsyn@gmail.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [RFC 1/2] hw/msi: Allow platform devices to use explicit SID
Date: Wed, 10 Aug 2016 15:23:50 +0800	[thread overview]
Message-ID: <20160810072350.GK4201@pxdev.xzpeter.org> (raw)
In-Reply-To: <CABdVeABHEydpv=MWL_3y3vuWMjb0nka9uYDjdcHeOt2W_tMPZA@mail.gmail.com>

On Wed, Aug 10, 2016 at 09:35:25AM +0300, David Kiarie wrote:
> On Wed, Aug 10, 2016 at 8:41 AM, Peter Xu <peterx@redhat.com> wrote:
> 
> > On Tue, Aug 09, 2016 at 05:32:16PM +0300, David Kiarie wrote:
> > > When using IOMMU platform devices like IOAPIC are required to make
> > > interrupt remapping requests using explicit SID.We affiliate an MSI
> > > route with a requester ID and a PCI device if present which ensures
> > > that platform devices can call IOMMU interrupt remapping code with
> > > explicit SID while maintaining compatility with the original code
> > > which mainly dealt with PCI devices.
> > >
> > > Signed-off-by: David Kiarie <davidkiarie4@gmail.com>
> >
> > Hi,
> >
> > This idea is good to me overall, with some tiny comments below.
> >
> > [...]
> >
> > > -static void ioapic_service(IOAPICCommonState *s)
> > > +static void ioapic_write_ioapic_as(IOAPICCommonState *s, uint32_t
> > data, uint64_t addr)
> >
> > Rename to ioapic_as_write()?
> >
> > [...]
> >
> > > @@ -385,12 +393,23 @@ static void ioapic_machine_done_notify(Notifier
> > *notifier, void *data)
> > >
> > >      if (kvm_irqchip_is_split()) {
> > >          X86IOMMUState *iommu = x86_iommu_get_default();
> > > +        MSIMessage msg = {0, 0};
> > > +        int i;
> > > +
> > >          if (iommu) {
> > >              /* Register this IOAPIC with IOMMU IEC notifier, so that
> > >               * when there are IR invalidates, we can be notified to
> > >               * update kernel IR cache. */
> > > -            x86_iommu_iec_register_notifier(iommu,
> > ioapic_iec_notifier, s);
> > > +            s->devid = iommu->ioapic_bdf;
> > > +            /* update IOAPIC routes to the right SID */
> > > +            for (i = 0; i < IOAPIC_NUM_PINS; i++) {
> > > +                kvm_irqchip_update_msi_route(kvm_state, i, msg, NULL,
> > s->devid);
> > > +            }
> > > +            kvm_irqchip_commit_routes(kvm_state);
> >
> > Here, not sure whether it'll be better if we remove
> > kvm_irqchip_add_msi_route() in kvm_arch_init_irq_routing() directly
> > and call them here. So no extra update needed.
> >
> 
> Thought about that too but  I was worried another device might reserve
> routes before IOAPIC does.

Right. Had a quick look, only thing I am not sure is how ivshmem setup
its routes. It seems that it's done before this notifier. So maybe
your method is good to keep.

-- peterx

  reply	other threads:[~2016-08-10  7:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 14:32 [Qemu-devel] [RFC 0/2] Explicit SID for IOAPIC David Kiarie
2016-08-09 14:32 ` [Qemu-devel] [RFC 1/2] hw/msi: Allow platform devices to use explicit SID David Kiarie
2016-08-10  5:41   ` Peter Xu
2016-08-10  6:35     ` David Kiarie
2016-08-10  7:23       ` Peter Xu [this message]
2016-08-09 14:32 ` [Qemu-devel] [RFC 2/2] hw/i386: enforce SID verification David Kiarie
2016-08-09 18:41   ` Valentine Sinitsyn
2016-08-09 18:46     ` David Kiarie
2016-08-10  5:49   ` Peter Xu
2016-08-10  6:30     ` David Kiarie
2016-08-10  7:09       ` Peter Xu
2016-08-09 14:39 ` [Qemu-devel] [RFC 0/2] Explicit SID for IOAPIC no-reply
2016-08-09 14:39 ` no-reply

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=20160810072350.GK4201@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=davidkiarie4@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=valentine.sinitsyn@gmail.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.