On Tue, Nov 22, 2016 at 04:08:50PM +0800, Peter Xu wrote: > We are very strict in the past getting MSIs from commit > d1f6af6a1 ("kvm-irqchip: simplify kvm_irqchip_add_msi_route"), assuming > that MSI should be configured before hand when fetching. When we have > unrecognized configurations, we panic the system. However looks like > this is too strict to be working on some platform, and issues occured. > Firstly it's found on a ppc case and fixed by David in: > > 6d17a01 vfio/pci: Fix regression in MSI routing configuration > > However we encountered another case now with windows virtio driver and > reported (and possibly more): > > http://bugs.debian.org/844361 > > To make every driver/hardware happy, let's loosen the rule and go back > to the original behavior - instead of panic the system, when we try to > fetch MSI without configured MSI/MSI-X system, we just provide an empty > message to make drivers happy. > > Reported-by: Maciej KotliĆski <makotlin...@gmail.com> > Signed-off-by: Peter Xu <pet...@redhat.com> > --- > hw/pci/pci.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index 24fae16..0cd2bb0 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -2606,9 +2606,11 @@ MSIMessage pci_get_msi_message(PCIDevice *dev, int > vector) > } else if (msi_enabled(dev)) { > msg = msi_get_message(dev, vector); > } else { > - /* Should never happen */ > - error_report("%s: unknown interrupt type", __func__); > - abort(); > + /* > + * Device is not configured with MSI/MSI-X yet, let's provide > + * an empty message to make all device drivers happy. > + */ > + memset(&msg, 0, sizeof(msg)); > } > return msg; > }
Looks like a hack to me. Even if callers happen to treat 0 message as a nop, there's no guarantee that's true for all platforms. Pls change pci_get_msi_message to return an error code, and fix callers to check that. > -- > 2.7.4