From: Auger Eric <eric.auger@redhat.com>
To: Julien Grall <julien.grall@arm.com>,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org
Cc: jason@lakedaemon.net, douliyangs@gmail.com, marc.zyngier@arm.com,
robin.murphy@arm.com, miquel.raynal@bootlin.com,
tglx@linutronix.de, logang@deltatee.com, bigeasy@linutronix.de,
linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v2 1/7] genirq/msi: Add a new field in msi_desc to store an IOMMU cookie
Date: Tue, 30 Apr 2019 14:53:31 +0200 [thread overview]
Message-ID: <a7edba11-e34c-047c-7852-28bbf87157e6@redhat.com> (raw)
In-Reply-To: <20190429144428.29254-2-julien.grall@arm.com>
Hi
On 4/29/19 4:44 PM, Julien Grall wrote:
> When an MSI doorbell is located downstream of an IOMMU, it is required
> to swizzle the physical address with an appropriately-mapped IOVA for any
> device attached to one of our DMA ops domain.
>
> At the moment, the allocation of the mapping may be done when composing
> the message. However, the composing may be done in non-preemtible
> context while the allocation requires to be called from preemptible
> context.
>
> A follow-up change will split the current logic in two functions
> requiring to keep an IOMMU cookie per MSI.
>
> A new field is introduced in msi_desc to store an IOMMU cookie. As the
> cookie may not be required in some configuration, the field is protected
> under a new config CONFIG_IRQ_MSI_IOMMU.
>
> A pair of helpers has also been introduced to access the field.
>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
Besides other's comments
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Thanks
Eric
>
> ---
> Changes in v2:
> - Update the commit message to use imperative mood
> - Protect the field with a new config that will be selected by
> IOMMU_DMA later on
> - Add a set of helpers to access the new field
> ---
> include/linux/msi.h | 26 ++++++++++++++++++++++++++
> kernel/irq/Kconfig | 3 +++
> 2 files changed, 29 insertions(+)
>
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index 7e9b81c3b50d..82a308c19222 100644
> --- a/include/linux/msi.h
> +++ b/include/linux/msi.h
> @@ -77,6 +77,9 @@ struct msi_desc {
> struct device *dev;
> struct msi_msg msg;
> struct irq_affinity_desc *affinity;
> +#ifdef CONFIG_IRQ_MSI_IOMMU
> + const void *iommu_cookie;
> +#endif
>
> union {
> /* PCI MSI/X specific data */
> @@ -119,6 +122,29 @@ struct msi_desc {
> #define for_each_msi_entry_safe(desc, tmp, dev) \
> list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list)
>
> +#ifdef CONFIG_IRQ_MSI_IOMMU
> +static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
> +{
> + return desc->iommu_cookie;
> +}
> +
> +static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
> + const void *iommu_cookie)
> +{
> + desc->iommu_cookie = iommu_cookie;
> +}
> +#else
> +static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
> +{
> + return NULL;
> +}
> +
> +static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
> + const void *iommu_cookie)
> +{
> +}
> +#endif
> +
> #ifdef CONFIG_PCI_MSI
> #define first_pci_msi_entry(pdev) first_msi_entry(&(pdev)->dev)
> #define for_each_pci_msi_entry(desc, pdev) \
> diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
> index 5f3e2baefca9..8fee06625c37 100644
> --- a/kernel/irq/Kconfig
> +++ b/kernel/irq/Kconfig
> @@ -91,6 +91,9 @@ config GENERIC_MSI_IRQ_DOMAIN
> select IRQ_DOMAIN_HIERARCHY
> select GENERIC_MSI_IRQ
>
> +config IRQ_MSI_IOMMU
> + bool
> +
> config HANDLE_DOMAIN_IRQ
> bool
>
>
next prev parent reply other threads:[~2019-04-30 12:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-29 14:44 [PATCH v2 0/7] iommu/dma-iommu: Split iommu_dma_map_msi_msg in two parts Julien Grall
2019-04-29 14:44 ` [PATCH v2 1/7] genirq/msi: Add a new field in msi_desc to store an IOMMU cookie Julien Grall
2019-04-29 15:12 ` Robin Murphy
2019-04-30 12:53 ` Auger Eric [this message]
2019-04-29 14:44 ` [PATCH v2 2/7] iommu/dma-iommu: Split iommu_dma_map_msi_msg() in two parts Julien Grall
2019-04-29 15:16 ` Robin Murphy
2019-04-29 15:28 ` Marc Zyngier
2019-04-30 12:54 ` Auger Eric
2019-04-29 14:44 ` [PATCH v2 3/7] irqchip/gicv2m: Don't map the MSI page in gicv2m_compose_msi_msg() Julien Grall
2019-04-30 12:34 ` Auger Eric
2019-04-29 14:44 ` [PATCH v2 4/7] irqchip/gic-v3-its: Don't map the MSI page in its_irq_compose_msi_msg() Julien Grall
2019-04-30 12:34 ` Auger Eric
2019-05-01 11:14 ` Julien Grall
2019-05-01 11:37 ` Marc Zyngier
2019-04-29 14:44 ` [PATCH v2 5/7] irqchip/ls-scfg-msi: Don't map the MSI page in ls_scfg_msi_compose_msg() Julien Grall
2019-04-29 14:44 ` [PATCH v2 6/7] irqchip/gic-v3-mbi: Don't map the MSI page in mbi_compose_m{b, s}i_msg() Julien Grall
2019-04-29 14:44 ` [PATCH v2 7/7] iommu/dma-iommu: Remove iommu_dma_map_msi_msg() Julien Grall
2019-04-29 15:19 ` Robin Murphy
2019-04-30 13:38 ` Auger Eric
2019-04-29 15:57 ` [PATCH v2 0/7] iommu/dma-iommu: Split iommu_dma_map_msi_msg in two parts Marc Zyngier
2019-04-29 19:35 ` Christoph Hellwig
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=a7edba11-e34c-047c-7852-28bbf87157e6@redhat.com \
--to=eric.auger@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=douliyangs@gmail.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jason@lakedaemon.net \
--cc=julien.grall@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=marc.zyngier@arm.com \
--cc=miquel.raynal@bootlin.com \
--cc=robin.murphy@arm.com \
--cc=tglx@linutronix.de \
/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).