On Mon, Sep 14, 2020 at 01:32:55PM -0400, Jon Derrick wrote: > Client VMD platforms have a software-triggered MSI/X vector 0 that will > not forward hardware-remapped MSI/X vectors from the sub-device domain. > This causes an issue with VMD platforms that use AHCI behind VMD and > have a single MSI/X vector mapping to vector 0. Add an MSI/X vector > offset for these platforms. > > Signed-off-by: Jon Derrick <jonathan.derrick@xxxxxxxxx> > --- > drivers/pci/controller/vmd.c | 35 +++++++++++++++++++++++++---------- > 1 file changed, 25 insertions(+), 10 deletions(-) > > diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c > index f69ef8c89f72..f8195bad79d1 100644 > --- a/drivers/pci/controller/vmd.c > +++ b/drivers/pci/controller/vmd.c > @@ -53,6 +53,12 @@ enum vmd_features { > * vendor-specific capability space > */ > VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP = (1 << 2), > + > + /* > + * Device may use MSI/X vector 0 for software triggering and will not > + * be used for MSI/X remapping > + */ > + VMD_FEAT_OFFSET_FIRST_VECTOR = (1 << 3), > }; > > /* > @@ -104,6 +110,7 @@ struct vmd_dev { > struct irq_domain *irq_domain; > struct pci_bus *bus; > u8 busn_start; > + u8 first_vec; > }; > > static inline struct vmd_dev *vmd_from_bus(struct pci_bus *bus) > @@ -199,25 +206,26 @@ static irq_hw_number_t vmd_get_hwirq(struct msi_domain_info *info, > */ > static struct vmd_irq_list *vmd_next_irq(struct vmd_dev *vmd, struct msi_desc *desc) > { > - int i, best = 1; > unsigned long flags; > + int i, best; > > if (vmd->msix_count == 1) This condition needs account for the vector offset, right? if (vmd->msix_count == 1 + vmd->first_vec)) > - return &vmd->irqs[0]; > + return &vmd->irqs[vmd->first_vec];