[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] x86/vPCI: tolerate (un)masking a disabled MSI-X entry



commit 04b090366ca59e8a75837c822df261a8d0bd1a30
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Jan 5 13:17:54 2021 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jan 5 13:17:54 2021 +0100

    x86/vPCI: tolerate (un)masking a disabled MSI-X entry
    
    None of the four reasons causing vpci_msix_arch_mask_entry() to get
    called (there's just a single call site) are impossible or illegal prior
    to an entry actually having got set up:
    - the entry may remain masked (in this case, however, a prior masked ->
      unmasked transition would already not have worked),
    - MSI-X may not be enabled,
    - the global mask bit may be set,
    - the entry may not otherwise have been updated.
    Hence the function asserting that the entry was previously set up was
    simply wrong. Since the caller tracks the masked state (and setting up
    of an entry would only be effected when that software bit is clear),
    it's okay to skip both masking and unmasking requests in this case.
    
    Fixes: d6281be9d0145 ('vpci/msix: add MSI-X handlers')
    Reported-by: Manuel Bouyer <bouyer@xxxxxxxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Tested-by: Manuel Bouyer <bouyer@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/vmsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index 7ca19353ab..ddcfc6c229 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -840,8 +840,8 @@ void vpci_msi_arch_print(const struct vpci_msi *msi)
 void vpci_msix_arch_mask_entry(struct vpci_msix_entry *entry,
                                const struct pci_dev *pdev, bool mask)
 {
-    ASSERT(entry->arch.pirq != INVALID_PIRQ);
-    vpci_mask_pirq(pdev->domain, entry->arch.pirq, mask);
+    if ( entry->arch.pirq != INVALID_PIRQ )
+        vpci_mask_pirq(pdev->domain, entry->arch.pirq, mask);
 }
 
 int vpci_msix_arch_enable_entry(struct vpci_msix_entry *entry,
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.