* [PATCH v2] iommu/dma: Fix IOVA reserve dma ranges @ 2020-09-11 10:25 Srinath Mannam via iommu 2020-09-11 15:16 ` Bjorn Helgaas 0 siblings, 1 reply; 3+ messages in thread From: Srinath Mannam via iommu @ 2020-09-11 10:25 UTC (permalink / raw) To: Robin Murphy, Joerg Roedel, Lorenzo Pieralisi, Bjorn Helgaas, poza Cc: Srinath Mannam, iommu, bcm-kernel-feedback-list, linux-kernel Fix IOVA reserve failure in the case when address of first memory region listed in dma-ranges is equal to 0x0. Fixes: aadad097cd46f ("iommu/dma: Reserve IOVA for PCIe inaccessible DMA address") Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com> --- Changes from v1: Removed unnecessary changes based on Robin's review comments. drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 5141d49a046b..682068a9aae7 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -217,7 +217,7 @@ static int iova_reserve_pci_windows(struct pci_dev *dev, lo = iova_pfn(iovad, start); hi = iova_pfn(iovad, end); reserve_iova(iovad, lo, hi); - } else { + } else if (end < start) { /* dma_ranges list should be sorted */ dev_err(&dev->dev, "Failed to reserve IOVA\n"); return -EINVAL; -- 2.17.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] iommu/dma: Fix IOVA reserve dma ranges 2020-09-11 10:25 [PATCH v2] iommu/dma: Fix IOVA reserve dma ranges Srinath Mannam via iommu @ 2020-09-11 15:16 ` Bjorn Helgaas 2020-09-14 7:11 ` Srinath Mannam via iommu 0 siblings, 1 reply; 3+ messages in thread From: Bjorn Helgaas @ 2020-09-11 15:16 UTC (permalink / raw) To: Srinath Mannam Cc: poza, linux-kernel, iommu, bcm-kernel-feedback-list, Bjorn Helgaas, Robin Murphy On Fri, Sep 11, 2020 at 03:55:34PM +0530, Srinath Mannam wrote: > Fix IOVA reserve failure in the case when address of first memory region > listed in dma-ranges is equal to 0x0. > > Fixes: aadad097cd46f ("iommu/dma: Reserve IOVA for PCIe inaccessible DMA address") > Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com> > --- > Changes from v1: > Removed unnecessary changes based on Robin's review comments. > > drivers/iommu/dma-iommu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c > index 5141d49a046b..682068a9aae7 100644 > --- a/drivers/iommu/dma-iommu.c > +++ b/drivers/iommu/dma-iommu.c > @@ -217,7 +217,7 @@ static int iova_reserve_pci_windows(struct pci_dev *dev, > lo = iova_pfn(iovad, start); > hi = iova_pfn(iovad, end); > reserve_iova(iovad, lo, hi); > - } else { > + } else if (end < start) { > /* dma_ranges list should be sorted */ > dev_err(&dev->dev, "Failed to reserve IOVA\n"); You didn't actually change the error message, but the message would be way more useful if it included the IOVA address range, e.g., the format used in pci_register_host_bridge(): bus address [%#010llx-%#010llx] Incidentally, the pr_err() in copy_reserved_iova() looks bogus; it prints iova->pfn_low twice, when it should probably print the base and size or (my preference) something like the above: pr_err("Reserve iova range %lx@%lx failed\n", iova->pfn_lo, iova->pfn_lo); > return -EINVAL; > -- > 2.17.1 > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] iommu/dma: Fix IOVA reserve dma ranges 2020-09-11 15:16 ` Bjorn Helgaas @ 2020-09-14 7:11 ` Srinath Mannam via iommu 0 siblings, 0 replies; 3+ messages in thread From: Srinath Mannam via iommu @ 2020-09-14 7:11 UTC (permalink / raw) To: Bjorn Helgaas Cc: poza, Linux Kernel Mailing List, iommu, BCM Kernel Feedback, Bjorn Helgaas, Robin Murphy On Fri, Sep 11, 2020 at 8:47 PM Bjorn Helgaas <helgaas@kernel.org> wrote: > Hi Bjorn, Thanks for review. > On Fri, Sep 11, 2020 at 03:55:34PM +0530, Srinath Mannam wrote: > > Fix IOVA reserve failure in the case when address of first memory region > > listed in dma-ranges is equal to 0x0. > > > > Fixes: aadad097cd46f ("iommu/dma: Reserve IOVA for PCIe inaccessible DMA address") > > Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com> > > --- > > Changes from v1: > > Removed unnecessary changes based on Robin's review comments. > > > > drivers/iommu/dma-iommu.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c > > index 5141d49a046b..682068a9aae7 100644 > > --- a/drivers/iommu/dma-iommu.c > > +++ b/drivers/iommu/dma-iommu.c > > @@ -217,7 +217,7 @@ static int iova_reserve_pci_windows(struct pci_dev *dev, > > lo = iova_pfn(iovad, start); > > hi = iova_pfn(iovad, end); > > reserve_iova(iovad, lo, hi); > > - } else { > > + } else if (end < start) { > > /* dma_ranges list should be sorted */ > > dev_err(&dev->dev, "Failed to reserve IOVA\n"); > It is very unlikely to come to this error, dma_ranges list is sorted in "devm_of_pci_get_host_bridge_resources" function. > You didn't actually change the error message, but the message would be > way more useful if it included the IOVA address range, e.g., the > format used in pci_register_host_bridge(): > > bus address [%#010llx-%#010llx] I will add this change and send the next patchset. Thanks & Regards, Srinath. > > Incidentally, the pr_err() in copy_reserved_iova() looks bogus; it > prints iova->pfn_low twice, when it should probably print the base and > size or (my preference) something like the above: > > pr_err("Reserve iova range %lx@%lx failed\n", > iova->pfn_lo, iova->pfn_lo); > > > return -EINVAL; > > -- > > 2.17.1 > > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-14 7:11 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-09-11 10:25 [PATCH v2] iommu/dma: Fix IOVA reserve dma ranges Srinath Mannam via iommu 2020-09-11 15:16 ` Bjorn Helgaas 2020-09-14 7:11 ` Srinath Mannam via iommu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).