xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: "Jianzhong,Chang" <changjzh@gmail.com>,
	keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com,
	xen-devel@lists.xen.org
Cc: Andra-Irina Paraschiv <andraprs@amazon.com>
Subject: Re: xen vtd : set msi guest_masked 0 by default
Date: Mon, 21 May 2018 12:46:19 +0100	[thread overview]
Message-ID: <1526903179.8186.43.camel@infradead.org> (raw)
In-Reply-To: <1453772092-24866-1-git-send-email-changjzh@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2187 bytes --]

On Tue, 2016-01-26 at 09:34 +0800, Jianzhong,Chang wrote:
> There are some problems when msi guest_masked is set to 1 by default.
> When guest os is windows 2008 r2 server,
> the device(eg X540-AT2 vf) is not initialized correctly.
> Host will always receive message like this :"VF Reset msg received from vf".
> Guest has network connectivity issues,
> and can not correctly receive/send the packet.

In other words "the guest doesn't get any interrupts from the NIC".

> So, guest_masked is set to 0 by default.

This seems consistent with the PCI spec, which says that "After reset,
the state of all implemented Mask and Pending bits is 0 (no vectors are
masked and no messages are pending)."

That's what we *used* to have in Xen, before these commits changed it
to assume that IRQs were guest-masked by default:

https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=ad28e42bd1d28d746988ed71654e8aa670629753
https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=84d6add5593d865736831d150da7c38588f669f6

> --- a/xen/arch/x86/msi.c
> +++ b/xen/arch/x86/msi.c
> @@ -512,7 +512,7 @@ void guest_mask_msi_irq(struct irq_desc *desc, bool_t mask)
>  
>  static unsigned int startup_msi_irq(struct irq_desc *desc)
>  {
> -    if ( unlikely(!msi_set_mask_bit(desc, 0, !!(desc->status & IRQ_GUEST))) )
> +    if ( unlikely(!msi_set_mask_bit(desc, 0, 0) ))
>          WARN();
>      return 0;
>  }

In testing, this part actually seems to make the difference in
practice. Interrupts now work, and Windows guests have connectivity
again.

> @@ -972,7 +972,7 @@ static int msix_capability_init(struct pci_dev *dev,
>          entry->msi_attrib.entry_nr = msi->entry_nr;
>          entry->msi_attrib.maskbit = 1;
>          entry->msi_attrib.host_masked = 1;
> -        entry->msi_attrib.guest_masked = 1;
> +        entry->msi_attrib.guest_masked = 0;
>          entry->msi_attrib.pos = pos;
>          entry->irq = msi->irq;
>          entry->dev = dev;

That also seems correct though, since it reflects the actual state we
intend to emulate.

[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

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

  parent reply	other threads:[~2018-05-21 11:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26  1:34 [PATCH] xen vtd : set msi guest_masked 0 by default Jianzhong,Chang
2016-01-26 12:56 ` Jan Beulich
2016-01-26 22:24   ` Tian, Kevin
2016-03-07  8:12   ` jzh Chang
2016-03-07 10:57     ` Jan Beulich
2018-05-21 11:46 ` David Woodhouse [this message]
2018-05-21 12:10   ` Roger Pau Monné
2018-05-23  7:01     ` David Woodhouse
2018-06-18  9:35       ` [PATCH qemu-xen-traditional] xen/pt: allow QEMU to request MSI unmasking at bind time Andra Paraschiv
2018-06-18 11:43         ` Roger Pau Monné
2018-06-21  8:37           ` Paraschiv, Andra-Irina
2018-07-31 10:22             ` Woodhouse, David
2018-09-17  8:40               ` Paraschiv, Andra-Irina
2018-10-09 13:55                 ` Ian Jackson
2018-10-09 15:23                   ` Paraschiv, Andra-Irina
2018-10-10 14:56                     ` Ian Jackson
2018-10-10 19:06                       ` Paraschiv, Andra-Irina
2018-06-18 10:31       ` xen vtd : set msi guest_masked 0 by default Paraschiv, Andra-Irina

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=1526903179.8186.43.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=andraprs@amazon.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=changjzh@gmail.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.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).