> -----Original Message----- > From: Bjorn Helgaas [mailto:helgaas@xxxxxxxxxx] > Sent: Tuesday, January 19, 2016 4:33 AM > To: Lawrynowicz, Jacek <jacek.lawrynowicz@xxxxxxxxx> > Cc: linux-pci@xxxxxxxxxxxxxxx; bhelgaas@xxxxxxxxxx; > dwmw2@xxxxxxxxxxxxx; jroedel@xxxxxxx > Subject: Re: [PATCH] pci: Add support for multiple DMA aliases > > On Mon, Jan 18, 2016 at 05:07:47PM +0100, Jacek Lawrynowicz wrote: > > This patch solves IOMMU support issues with PCIe non-transparent > > bridges that use Requester ID look-up tables (LUT), e.g. PEX8733. > > Before exiting the bridge, packet's RID is rewritten according to LUT > > programmed by a driver. Modified packets are then passed to a > > destination bus and processed upstream. The problem is that such > > packets seem to come from non-existent nodes that are hidden behind > > NTB and are not discoverable by a destination node, so IOMMU discards > > them. Adding DMA alias for a given LUT entry allows IOMMU to create a > > proper mapping that enables inter-node communication. > > > > The current DMA alias implementation supports only single alias, so > > it's not possible to connect more than two nodes when IOMMU is > > enabled. This implementation enables all possible aliases on a given > > bus (256) that are stored in a bitset. Alias devfn is directly > > translated to a bit number. The bitset is not allocated for devices > > that have no need for DMA aliases. > > > > More details can be found in following article: > > > http://www.plxtech.com/files/pdf/technical/expresslane/RTC_Enabling%20 > > MulitHostSystemDesigns.pdf > > > > Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@xxxxxxxxx> > > Acked-by: David Woodhouse <David.Woodhouse@xxxxxxxxx> > > Acked-by: Joerg Roedel <jroedel@xxxxxxx> > > I applied this to pci/iommu and intend to merge it for v4.5. > > I made the following change because the kcalloc() failure warning in your > patch looks wrong: > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b0d6a0a..29cfe1a 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -4577,13 +4577,15 @@ int pci_set_vga_state(struct pci_dev *dev, bool > decode, > */ > void pci_add_dma_alias(struct pci_dev *dev, u8 devfn) { > - if (!dev->dma_alias_mask) { > + if (!dev->dma_alias_mask) > dev->dma_alias_mask = kcalloc(BITS_TO_LONGS(U8_MAX), > sizeof(long), GFP_KERNEL); > - dev_warn(&dev->dev, "Unable to allocate DMA alias > mask.\n"); > + if (!dev->dma_alias_mask) { > + dev_warn(&dev->dev, "Unable to allocate DMA alias > mask\n"); > + return; > } > - if (dev->dma_alias_mask) > - set_bit(devfn, dev->dma_alias_mask); > + > + set_bit(devfn, dev->dma_alias_mask); > } > EXPORT_SYMBOL_GPL(pci_add_dma_alias); Yes, you're right. Thanks. -- Jacek Lawrynowicz Intel Technology Poland sp. z o.o. KRS 101882 - ul. Slowackiego 173, 80-298 Gdansk -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html