All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 1/2] vpci/msi: split code to bind pirq
Date: Mon, 14 May 2018 15:15:35 +0100	[thread overview]
Message-ID: <20180514141535.5nlnghuxlo7erlap@MacBook-Pro-de-Roger.local> (raw)
In-Reply-To: <5AF9800502000078001C278D@prv1-mh.provo.novell.com>

On Mon, May 14, 2018 at 06:24:37AM -0600, Jan Beulich wrote:
> >>> On 08.05.18 at 11:25, <roger.pau@citrix.com> wrote:
> > --- a/xen/arch/x86/hvm/vmsi.c
> > +++ b/xen/arch/x86/hvm/vmsi.c
> > @@ -663,6 +663,42 @@ void vpci_msi_arch_mask(struct vpci_msi *msi, const struct pci_dev *pdev,
> >      vpci_mask_pirq(pdev->domain, msi->arch.pirq + entry, mask);
> >  }
> >  
> > +static int vpci_msi_update(const struct pci_dev *pdev, uint32_t data,
> > +                           uint64_t address, unsigned int vectors,
> > +                           unsigned int pirq, uint32_t mask)
> > +{
> > +    unsigned int i;
> > +
> > +    ASSERT(pcidevs_locked());
> > +
> > +    for ( i = 0; i < vectors; i++ )
> > +    {
> > +        uint8_t vector = MASK_EXTR(data, MSI_DATA_VECTOR_MASK);
> > +        uint8_t vector_mask = 0xff >> (8 - fls(vectors) + 1);
> > +        struct xen_domctl_bind_pt_irq bind = {
> > +            .machine_irq = pirq + i,
> > +            .irq_type = PT_IRQ_TYPE_MSI,
> > +            .u.msi.gvec = (vector & ~vector_mask) |
> > +                          ((vector + i) & vector_mask),
> > +            .u.msi.gflags = msi_gflags(data, address, (mask >> i) & 1),
> > +        };
> > +        int rc = pt_irq_create_bind(pdev->domain, &bind);
> > +
> > +        if ( rc )
> > +        {
> > +            gdprintk(XENLOG_ERR,
> > +                     "%04x:%02x:%02x.%u: failed to bind PIRQ %u: %d\n",
> > +                     pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
> > +                     PCI_FUNC(pdev->devfn), pirq + i, rc);
> > +            while ( bind.machine_irq-- )
> > +                pt_irq_destroy_bind(pdev->domain, &bind);
> 
> I realize this is just code movement, but is this while() correct? I think it
> can only be correct if pirq (which bind.machine_irq gets initialized from)
> was always zero, yet that doesn't look to be the case.
> 
> If you agree, I'd prefer fixed code to be moved (read: wants a prereq
> patch), or for the fix to be applied while moving the code (suitably
> reasoned about in the description).

Right, this should be:

while ( bind.machine_irq-- >= pirq )
    pt_irq_destroy_bind(pdev->domain, &bind);

Will fix before moving the code.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-05-14 14:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08  9:23 [PATCH 0/2] vpci/msi: fix updating already bound MSI interrupts Roger Pau Monne
2018-05-08  9:25 ` [PATCH 1/2] vpci/msi: split code to bind pirq Roger Pau Monne
2018-05-14 12:24   ` Jan Beulich
2018-05-14 14:15     ` Roger Pau Monné [this message]
2018-05-14 14:56       ` Jan Beulich
2018-05-14 15:00         ` Roger Pau Monné
2018-05-14 15:07           ` Jan Beulich
2018-05-08  9:25 ` [PATCH 2/2] vpci/msi: fix update of bound MSI interrupts Roger Pau Monne
2018-05-14 12:29   ` Jan Beulich
2018-05-14 14:27     ` Roger Pau Monné
2018-05-14 14:59       ` Jan Beulich
2018-05-08  9:30 ` [PATCH 0/2] vpci/msi: fix updating already " Juergen Gross
2018-05-08  9:40   ` Roger Pau Monné

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=20180514141535.5nlnghuxlo7erlap@MacBook-Pro-de-Roger.local \
    --to=roger.pau@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xenproject.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 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.