From: Alex Williamson <alex.williamson@redhat.com>
To: "Lawrynowicz, Jacek" <jacek.lawrynowicz@intel.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
linux-pci@vger.kernel.org, bhelgaas@google.com,
dwmw2@infradead.org, jroedel@suse.de
Subject: Re: [PATCH v2 1/2] pci: Add support for multiple DMA aliases
Date: Wed, 27 Jan 2016 13:25:24 -0700 [thread overview]
Message-ID: <1453926324.18221.2.camel@redhat.com> (raw)
In-Reply-To: <20160127200546.GA16324@jlawryno-MOBL1>
On Wed, 2016-01-27 at 21:05 +0100, Lawrynowicz, Jacek wrote:
> On Tue, Jan 26, 2016 at 05:54:47PM -0700, Alex Williamson wrote:
> > On Tue, 2016-01-26 at 18:04 -0600, Bjorn Helgaas wrote:
> > > On Tue, Jan 26, 2016 at 04:42:23PM -0700, Alex Williamson wrote:
> > > > On Tue, 2016-01-26 at 17:31 -0600, Bjorn Helgaas wrote:
> > > > > > + * aliases are only supported on the same bus, therefore the search
> > > > > > * space is quite small (especially since we're really only looking at pcie
> > > > > > * device, and therefore only expect multiple slots on the root complex or
> > > > > > * downstream switch ports). It's conceivable though that a pair of
> > > > > > @@ -686,11 +686,8 @@ static struct iommu_group *get_pci_alias_group(struct pci_dev *pdev,
> > > > > > continue;
> > > > > >
> > > > > > /* We alias them or they alias us */
> > > > > > - if (((pdev->dev_flags & PCI_DEV_FLAGS_DMA_ALIAS_DEVFN) &&
> > > > > > - pdev->dma_alias_devfn == tmp->devfn) ||
> > > > > > - ((tmp->dev_flags & PCI_DEV_FLAGS_DMA_ALIAS_DEVFN) &&
> > > > > > - tmp->dma_alias_devfn == pdev->devfn)) {
> > > > > > -
> > > > > > + if (pci_dma_alias_is_enabled(pdev, tmp->devfn) ||
> > > > > > + pci_dma_alias_is_enabled(tmp, pdev->devfn)) {
> > > > >
> > > > > I was hoping for something that took two pci_dev pointers and returned
> > > > > true if they were aliases of each other, e.g.,
> > > > >
> > > > > bool pci_dma_aliases(struct pci_dev *dev1, struct pci_dev *dev2);
> > > >
> > > > Such a thing could already be created with pci_for_each_dma_alias().
> > >
> > > Does that mean we could get replace the use of for_each_pci_dev() with some
> > > clever use of pci_for_each_dma_alias()?
> >
> > Not remotely, but if we're going to have an is-alias function, should it
> > be limited to aliases on the same bus? What if I call it on a
> > conventional PCI device where everything on the bus is an alias, this
> > implementation of relying only on the bitmap doesn't even work. Thanks,
>
> So should I change it to pci_dma_aliases() or leave it?
My complaint is not about the name, but about the scope of the function.
The function get_pci_alias_group() defines the scope to be aliases on
the same bus, so it gets by with only testing dma_alias_devfn on
devices. You're trying to offload this to a helper function, which is
usually a good thing, but that helper doesn't bring with it the same
limited scope. Anybody can call that helper, where maybe it's not
appropriate that the scope is so limited. So if you really just want to
fix get_pci_alias_group() with the equivalent functionality for having
multiple devfn aliases, the helper should be static so that it's not
misinterpreted as a generic helper. Thanks,
Alex
next prev parent reply other threads:[~2016-01-27 20:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-26 10:31 [PATCH v2 1/2] pci: Add support for multiple DMA aliases Jacek Lawrynowicz
2016-01-26 10:31 ` [PATCH v2 2/2] pci: Add DMA alias quirk for mic_x200_dma Jacek Lawrynowicz
2016-01-26 16:28 ` Alex Williamson
2016-01-26 17:20 ` Lawrynowicz, Jacek
2016-01-26 17:24 ` Jacek Lawrynowicz
2016-01-26 11:59 ` [PATCH v2 1/2] pci: Add support for multiple DMA aliases David Woodhouse
2016-01-26 12:04 ` Lawrynowicz, Jacek
2016-01-26 12:27 ` David Woodhouse
2016-01-26 14:34 ` Bjorn Helgaas
2016-01-26 14:52 ` Jacek Lawrynowicz
2016-01-26 15:07 ` David Woodhouse
2016-01-26 16:27 ` Alex Williamson
2016-01-26 17:12 ` Jacek Lawrynowicz
2016-01-26 23:31 ` Bjorn Helgaas
2016-01-26 23:42 ` Alex Williamson
2016-01-27 0:04 ` Bjorn Helgaas
2016-01-27 0:54 ` Alex Williamson
2016-01-27 20:05 ` Lawrynowicz, Jacek
2016-01-27 20:25 ` Alex Williamson [this message]
2016-01-30 11:06 ` [PATCH v3 0/2] Fixed couple of issues pointed by Alex and Bjorn Jacek Lawrynowicz
2016-01-30 11:06 ` [PATCH v3 1/2] pci: Add support for multiple DMA aliases Jacek Lawrynowicz
2016-02-15 17:22 ` Joerg Roedel
2016-01-30 11:06 ` [PATCH v3 2/2] pci: Add DMA alias quirk for mic_x200_dma Jacek Lawrynowicz
2016-01-27 20:01 ` [PATCH v2 1/2] pci: Add support for multiple DMA aliases Lawrynowicz, Jacek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453926324.18221.2.camel@redhat.com \
--to=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=dwmw2@infradead.org \
--cc=helgaas@kernel.org \
--cc=jacek.lawrynowicz@intel.com \
--cc=jroedel@suse.de \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.