* [PATCH] x86/MSI-X: correctly track interrupt masking state
@ 2016-04-22 7:20 Jan Beulich
2016-04-22 16:35 ` Andrew Cooper
0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2016-04-22 7:20 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Keir Fraser
[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]
When a guest unmasks MSI-X interrupts before enabling MSI-X on the
device, so far nothing updates the {host,guest}_masked internal state;
this to date only gets done when MSI-X is already enabled. This is why
half way recent Linux works (as it enables MSI-X first), while Windows
doesn't (as it enables MSI-X only after having set up und unmasked all
vectors). Since with a successful write to the vector control field
everything is ready internally, we should also update internal tracking
state there, regardless of the device's MSI-X enabled state.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -434,8 +434,13 @@ static bool_t msi_set_mask_bit(struct ir
{
writel(flag, entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
readl(entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
+
if ( likely(control & PCI_MSIX_FLAGS_ENABLE) )
break;
+
+ entry->msi_attrib.host_masked = host;
+ entry->msi_attrib.guest_masked = guest;
+
flag = 1;
}
else if ( flag && !(control & PCI_MSIX_FLAGS_MASKALL) )
[-- Attachment #2: x86-MSI-X-track-masking-state.patch --]
[-- Type: text/plain, Size: 1253 bytes --]
x86/MSI-X: correctly track interrupt masking state
When a guest unmasks MSI-X interrupts before enabling MSI-X on the
device, so far nothing updates the {host,guest}_masked internal state;
this to date only gets done when MSI-X is already enabled. This is why
half way recent Linux works (as it enables MSI-X first), while Windows
doesn't (as it enables MSI-X only after having set up und unmasked all
vectors). Since with a successful write to the vector control field
everything is ready internally, we should also update internal tracking
state there, regardless of the device's MSI-X enabled state.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -434,8 +434,13 @@ static bool_t msi_set_mask_bit(struct ir
{
writel(flag, entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
readl(entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
+
if ( likely(control & PCI_MSIX_FLAGS_ENABLE) )
break;
+
+ entry->msi_attrib.host_masked = host;
+ entry->msi_attrib.guest_masked = guest;
+
flag = 1;
}
else if ( flag && !(control & PCI_MSIX_FLAGS_MASKALL) )
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/MSI-X: correctly track interrupt masking state
2016-04-22 7:20 [PATCH] x86/MSI-X: correctly track interrupt masking state Jan Beulich
@ 2016-04-22 16:35 ` Andrew Cooper
2016-04-25 11:24 ` Jan Beulich
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2016-04-22 16:35 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Keir Fraser
On 22/04/16 08:20, Jan Beulich wrote:
> When a guest unmasks MSI-X interrupts before enabling MSI-X on the
> device, so far nothing updates the {host,guest}_masked internal state;
> this to date only gets done when MSI-X is already enabled. This is why
> half way recent Linux works (as it enables MSI-X first), while Windows
> doesn't (as it enables MSI-X only after having set up und unmasked all
> vectors). Since with a successful write to the vector control field
> everything is ready internally, we should also update internal tracking
> state there, regardless of the device's MSI-X enabled state.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/MSI-X: correctly track interrupt masking state
2016-04-22 16:35 ` Andrew Cooper
@ 2016-04-25 11:24 ` Jan Beulich
2016-04-25 11:29 ` Wei Liu
0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2016-04-25 11:24 UTC (permalink / raw)
To: Wei Liu; +Cc: Andrew Cooper, Keir Fraser, xen-devel
>>> On 22.04.16 at 18:35, <andrew.cooper3@citrix.com> wrote:
> On 22/04/16 08:20, Jan Beulich wrote:
>> When a guest unmasks MSI-X interrupts before enabling MSI-X on the
>> device, so far nothing updates the {host,guest}_masked internal state;
>> this to date only gets done when MSI-X is already enabled. This is why
>> half way recent Linux works (as it enables MSI-X first), while Windows
>> doesn't (as it enables MSI-X only after having set up und unmasked all
>> vectors). Since with a successful write to the vector control field
>> everything is ready internally, we should also update internal tracking
>> state there, regardless of the device's MSI-X enabled state.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Wei,
just noticed I forgot to Cc you on this one, which definitely is
intended for 4.7 (along with the other two MSI related ones).
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/MSI-X: correctly track interrupt masking state
2016-04-25 11:24 ` Jan Beulich
@ 2016-04-25 11:29 ` Wei Liu
0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2016-04-25 11:29 UTC (permalink / raw)
To: Jan Beulich; +Cc: Andrew Cooper, Keir Fraser, Wei Liu, xen-devel
On Mon, Apr 25, 2016 at 05:24:43AM -0600, Jan Beulich wrote:
> >>> On 22.04.16 at 18:35, <andrew.cooper3@citrix.com> wrote:
> > On 22/04/16 08:20, Jan Beulich wrote:
> >> When a guest unmasks MSI-X interrupts before enabling MSI-X on the
> >> device, so far nothing updates the {host,guest}_masked internal state;
> >> this to date only gets done when MSI-X is already enabled. This is why
> >> half way recent Linux works (as it enables MSI-X first), while Windows
> >> doesn't (as it enables MSI-X only after having set up und unmasked all
> >> vectors). Since with a successful write to the vector control field
> >> everything is ready internally, we should also update internal tracking
> >> state there, regardless of the device's MSI-X enabled state.
> >>
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >
> > Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-04-25 11:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-22 7:20 [PATCH] x86/MSI-X: correctly track interrupt masking state Jan Beulich
2016-04-22 16:35 ` Andrew Cooper
2016-04-25 11:24 ` Jan Beulich
2016-04-25 11:29 ` Wei Liu
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.