The current implementation of host_maskall makes it sticky across
assign and deassign calls, which means that once a guest forces Xen to
set host_maskall the maskall bit is not going to be cleared until a
call to PHYSDEVOP_prepare_msix is performed. Such call however
shouldn't be part of the normal flow when doing PCI passthrough, and
hence the flag needs to be cleared when assigning in order to prevent
host_maskall being carried over from previous assignations.

Note that other mask fields, like guest_masked or the entry maskbit
are already reset when the msix capability is initialized. Also note
that doing the reset of host_maskall there would allow the guest to
reset such field by enabling and disabling MSIX, which is not
intended.

Signed-off-by: Roger Pau Monné <[email protected]>
---
Cc: Chao Gao <[email protected]>
Cc: "Spassov, Stanislav" <[email protected]>
Cc: Pasi Kärkkäinen <[email protected]>
---
Chao, Stanislav, can you please check if this patch fixes your
issues?
---
 xen/drivers/passthrough/pci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 7deef2f12b..b4f1ac2dd9 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -1504,7 +1504,10 @@ static int assign_device(struct domain *d, u16 seg, u8 
bus, u8 devfn, u32 flag)
     }
 
     if ( pdev->msix )
+    {
         msixtbl_init(d);
+        pdev->msix->host_maskall = false;
+    }
 
     pdev->fault.count = 0;
 
-- 
2.23.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to