From: Christoph Hellwig <hch@lst.de>
To: Jon Derrick <jonathan.derrick@intel.com>
Cc: linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org,
Bjorn Helgaas <helgaas@kernel.org>,
Keith Busch <kbusch@kernel.org>,
David Woodhouse <dwmw2@infradead.org>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v3 3/5] PCI: Introduce pci_direct_dma_alias()
Date: Tue, 14 Jan 2020 09:51:38 +0100 [thread overview]
Message-ID: <20200114085138.GC32024@lst.de> (raw)
In-Reply-To: <1578676873-6206-4-git-send-email-jonathan.derrick@intel.com>
On Fri, Jan 10, 2020 at 10:21:11AM -0700, Jon Derrick wrote:
> The current DMA alias implementation requires the aliased device be on
> the same PCI bus as the requester ID. This introduces an arch-specific
> mechanism to point to another PCI device when doing mapping and
> PCI DMA alias search.
>
> Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
> ---
> arch/x86/pci/common.c | 7 +++++++
> drivers/pci/pci.c | 19 ++++++++++++++++++-
> drivers/pci/search.c | 7 +++++++
> include/linux/pci.h | 1 +
> 4 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
> index 1e59df0..83334a5 100644
> --- a/arch/x86/pci/common.c
> +++ b/arch/x86/pci/common.c
> @@ -736,3 +736,10 @@ int pci_ext_cfg_avail(void)
> else
> return 0;
> }
> +
> +#if IS_ENABLED(CONFIG_VMD)
> +struct pci_dev *pci_direct_dma_alias(struct pci_dev *dev)
> +{
> + return to_pci_sysdata(dev->bus)->vmd_dev;
> +}
> +#endif
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index ad746d9..1362694 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -6034,7 +6034,9 @@ bool pci_devs_are_dma_aliases(struct pci_dev *dev1, struct pci_dev *dev2)
> return (dev1->dma_alias_mask &&
> test_bit(dev2->devfn, dev1->dma_alias_mask)) ||
> (dev2->dma_alias_mask &&
> - test_bit(dev1->devfn, dev2->dma_alias_mask));
> + test_bit(dev1->devfn, dev2->dma_alias_mask)) ||
> + (pci_direct_dma_alias(dev1) == dev2) ||
> + (pci_direct_dma_alias(dev2) == dev1);
No need for the inner braces here.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2020-01-14 8:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-10 17:21 [PATCH v3 0/5] Clean up VMD DMA Map Ops Jon Derrick
2020-01-10 17:21 ` [PATCH v3 1/5] x86/pci: Add a to_pci_sysdata helper Jon Derrick
2020-01-13 14:40 ` Bjorn Helgaas
2020-01-14 8:49 ` Christoph Hellwig
2020-01-10 17:21 ` [PATCH v3 2/5] x86/PCI: Expose VMD's PCI Device in pci_sysdata Jon Derrick
2020-01-14 8:50 ` Christoph Hellwig
2020-01-10 17:21 ` [PATCH v3 3/5] PCI: Introduce pci_direct_dma_alias() Jon Derrick
2020-01-14 8:51 ` Christoph Hellwig [this message]
2020-01-10 17:21 ` [PATCH v3 4/5] PCI: vmd: Stop overriding dma_map_ops Jon Derrick
2020-01-14 8:54 ` Christoph Hellwig
2020-01-17 18:17 ` Derrick, Jonathan
2020-01-10 17:21 ` [PATCH v3 5/5] x86/pci: Remove X86_DEV_DMA_OPS Jon Derrick
2020-01-13 12:08 ` [PATCH v3 0/5] Clean up VMD DMA Map Ops Lorenzo Pieralisi
2020-01-13 17:13 ` Derrick, Jonathan
2020-01-13 18:01 ` Bjorn Helgaas
2020-01-13 18:17 ` Lorenzo Pieralisi
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=20200114085138.GC32024@lst.de \
--to=hch@lst.de \
--cc=dwmw2@infradead.org \
--cc=helgaas@kernel.org \
--cc=iommu@lists.linux-foundation.org \
--cc=jonathan.derrick@intel.com \
--cc=kbusch@kernel.org \
--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 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).