[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7e77331c-4adf-5bb4-0c23-4d01a6ac5ab4@arm.com>
Date: Tue, 23 Apr 2019 11:23:57 +0100
From: Marc Zyngier <marc.zyngier@....com>
To: Julien Grall <julien.grall@....com>, linux-kernel@...r.kernel.org,
iommu@...ts.linux-foundation.org
Cc: logang@...tatee.com, douliyangs@...il.com,
miquel.raynal@...tlin.com, jason@...edaemon.net,
tglx@...utronix.de, joro@...tes.org, robin.murphy@....com,
bigeasy@...utronix.de, linux-rt-users@...r.kernel.org
Subject: Re: [PATCH 1/7] genirq/msi: Add a new field in msi_desc to store an
IOMMU cookie
Hi Julien,
On 18/04/2019 18:26, 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 patch will split the current logic in two functions
> requiring to keep an IOMMU cookie per MSI.
>
> This patch introduces a new field in msi_desc to store an IOMMU cookie
> when CONFIG_IOMMU_DMA is selected.
>
> Signed-off-by: Julien Grall <julien.grall@....com>
> ---
> include/linux/msi.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index 7e9b81c3b50d..d7907feef1bb 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_IOMMU_DMA
> + const void *iommu_cookie;
> +#endif
>
> union {
> /* PCI MSI/X specific data */
>
Given that this is the only member in this structure that is dependent
on a config option, you could also add a couple of accessors that would
do nothing when IOMMU_DMA is not selected (and use that in the DMA code).
Thanks,
M.
--
Jazz is not dead. It just smells funny...
Powered by blists - more mailing lists