virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Angus Chen <angus.chen@jaguarmicro.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH] virtio_pci: use irq to detect interrupt support
Date: Fri, 14 Oct 2022 01:32:42 -0400	[thread overview]
Message-ID: <20221014013156-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <TY2PR06MB3424171328BEE476FCB9942785249@TY2PR06MB3424.apcprd06.prod.outlook.com>

On Fri, Oct 14, 2022 at 12:09:20AM +0000, Angus Chen wrote:
> Hi Mst
> 
> > -----Original Message-----
> > From: Michael S. Tsirkin <mst@redhat.com>
> > Sent: Thursday, October 13, 2022 6:04 AM
> > To: linux-kernel@vger.kernel.org
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>; Michael Ellerman
> > <mpe@ellerman.id.au>; Angus Chen <angus.chen@jaguarmicro.com>; Jason
> > Wang <jasowang@redhat.com>; virtualization@lists.linux-foundation.org
> > Subject: [PATCH] virtio_pci: use irq to detect interrupt support
> > 
> > commit 71491c54eafa ("virtio_pci: don't try to use intxif pin is zero")
> > breaks virtio_pci on powerpc, when running as a qemu guest.
> > 
> > vp_find_vqs() bails out because pci_dev->pin == 0.
> > 
> > But pci_dev->irq is populated correctly, so vp_find_vqs_intx() would
> > succeed if we called it - which is what the code used to do.
> > 
> > This seems to happen because pci_dev->pin is not populated in
> > pci_assign_irq().
> > 
> > Which is absolutely a bug in the relevant PCI code, but it
> > may also affect other platforms that use of_irq_parse_and_map_pci().
> > 
> > However Linus said:
> > 	The correct way to check for "no irq" doesn't use NO_IRQ at all, it just does
> > 		if (dev->irq) ...
> > so let's just check irq and be done with it.
> > 
> > Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> > Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> > Fixes: 71491c54eafa ("virtio_pci: don't try to use intxif pin is zero")
> > Cc: "Angus Chen" <angus.chen@jaguarmicro.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > 
> > Build tested only - very late here. Angus any chance you could
> > help test this? Thanks!
> I tested the patch ,it work well on x86。Inlcude legacy and modern driver.
> And I tested it on arm server also,and find some problem because of 0.9.5 limitation.
>  "platform bug: legacy virtio-pci must not be used with RAM above 0x%llxGB\n",
>  But the error is not effected by our patch.with or without our patch ,it print the same.

Yes that's a limitation of 0.9.5 - just make a smaller VM to test
legacy.

> And I test modern dirver,it work well also.
> Sorry for the late reply.


Great, thanks a lot!

> > 
> >  drivers/virtio/virtio_pci_common.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/virtio/virtio_pci_common.c
> > b/drivers/virtio/virtio_pci_common.c
> > index 4df77eeb4d16..a6c86f916dbd 100644
> > --- a/drivers/virtio/virtio_pci_common.c
> > +++ b/drivers/virtio/virtio_pci_common.c
> > @@ -409,8 +409,8 @@ int vp_find_vqs(struct virtio_device *vdev, unsigned int
> > nvqs,
> >  	err = vp_find_vqs_msix(vdev, nvqs, vqs, callbacks, names, false, ctx, desc);
> >  	if (!err)
> >  		return 0;
> > -	/* Is there an interrupt pin? If not give up. */
> > -	if (!(to_vp_device(vdev)->pci_dev->pin))
> > +	/* Is there an interrupt? If not give up. */
> > +	if (!(to_vp_device(vdev)->pci_dev->irq))
> >  		return err;
> >  	/* Finally fall back to regular interrupts. */
> >  	return vp_find_vqs_intx(vdev, nvqs, vqs, callbacks, names, ctx);
> > --
> > MST
> 

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

      parent reply	other threads:[~2022-10-14  5:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 22:04 [PATCH] virtio_pci: use irq to detect interrupt support Michael S. Tsirkin
2022-10-12 22:27 ` Linus Torvalds
2022-10-13  1:34 ` Michael Ellerman
2022-10-13  2:29 ` Jason Wang
     [not found] ` <TY2PR06MB3424171328BEE476FCB9942785249@TY2PR06MB3424.apcprd06.prod.outlook.com>
2022-10-14  5:32   ` Michael S. Tsirkin [this message]

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=20221014013156-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=angus.chen@jaguarmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=torvalds@linux-foundation.org \
    --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).