From: Randy Dunlap <rdunlap@infradead.org>
To: Logan Gunthorpe <logang@deltatee.com>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
linux-ntb@googlegroups.com
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Alex Williamson <alex.williamson@redhat.com>,
Doug Meyer <dmeyer@gigaio.com>
Subject: Re: [PATCH v2] PCI: Expand documentation for pci_add_dma_alias()
Date: Thu, 24 May 2018 10:44:03 -0700 [thread overview]
Message-ID: <b2481367-3acc-4d54-bae7-cc27fb38232e@infradead.org> (raw)
In-Reply-To: <20180524173913.4506-1-logang@deltatee.com>
On 05/24/2018 10:39 AM, Logan Gunthorpe wrote:
> Seeing there's been some confusion about the use of pci_add_dma_alias(),
> expand the comment to describe why it must be called early and how
> early it must be called.
>
> Also, expand on the purpose of this function and common reasons it would
> be used.
>
> [The comment was reworded to some extent by Alex Williamson]
>
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: Doug Meyer <dmeyer@gigaio.com>
> ---
>
> v2: Reworked the patch with Alex's suggested wording.
>
> drivers/pci/pci.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index dbfe7c4f3776..1c0c1ea23b90 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5395,8 +5395,19 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
> * @dev: the PCI device for which alias is added
> * @devfn: alias slot and function
> *
> - * This helper encodes 8-bit devfn as bit number in dma_alias_mask.
> - * It should be called early, preferably as PCI fixup header quirk.
> + * This helper encodes an 8-bit devfn as a bit number in dma_alias_mask
> + * which is used to program permissible BDF source addresses for DMA
It took me a few seconds to decode BDF. FWIW, I would prefer to see
bus-devfn or bus-dev-fn or bus-dev-func or bus-dev-function.
> + * requests in an IOMMU. These aliases factor into IOMMU group creation
> + * and are useful for devices generating DMA requests beyond or different
> + * from their logical bus devfn. Examples include device quirks where the
^ Here it's "bus devfn."
> + * device simply uses the wronge devfn, as well as non-transparent bridges
wrong
> + * where the alias may be a proxy for devices in another domain.
> + *
> + * IOMMU group creation is performed during device discovery or addition,
> + * prior to any potential DMA mapping and therefore prior to driver probing
> + * (especially for userspace assigned devices where IOMMU group definition
> + * cannot be left as a userspace activity). DMA aliases should therefore
> + * be configured via quirks, such as the PCI fixup header quirk.
> */
> void pci_add_dma_alias(struct pci_dev *dev, u8 devfn)
> {
> --
> 2.11.0
>
--
~Randy
next prev parent reply other threads:[~2018-05-24 17:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-24 17:39 Logan Gunthorpe
2018-05-24 17:44 ` Randy Dunlap [this message]
2018-05-24 17:51 ` Logan Gunthorpe
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=b2481367-3acc-4d54-bae7-cc27fb38232e@infradead.org \
--to=rdunlap@infradead.org \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=dmeyer@gigaio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ntb@googlegroups.com \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
/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
all inboxes | Powered by JetHome®