From: Marc Zyngier <marc.zyngier@arm.com>
To: Robin Murphy <robin.murphy@arm.com>,
Julien Grall <julien.grall@arm.com>,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org
Cc: logang@deltatee.com, douliyangs@gmail.com,
miquel.raynal@bootlin.com, jason@lakedaemon.net,
tglx@linutronix.de, joro@8bytes.org, bigeasy@linutronix.de,
linux-rt-users@vger.kernel.org
Subject: Re: [PATCH 1/7] genirq/msi: Add a new field in msi_desc to store an IOMMU cookie
Date: Tue, 23 Apr 2019 14:42:17 +0100 [thread overview]
Message-ID: <6e9fb7c6-ca24-8790-967e-6e01cb6f81da@arm.com> (raw)
In-Reply-To: <468df11c-fe2a-2584-7306-185531653331@arm.com>
On 23/04/2019 14:19, Robin Murphy wrote:
> On 23/04/2019 12:46, Marc Zyngier wrote:
>> On 23/04/2019 11:51, Julien Grall wrote:
>>> On 4/23/19 11:23 AM, Marc Zyngier wrote:
>>>> Hi Julien,
>>>
>>> Hi Marc,
>>>
>>>> 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@arm.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).
>>>
>>> I haven't seen any use of the helpers so far because the DMA code is
>>> also protected by IOMMU_DMA.
>>>
>>> I can add the helpers in the next version if you see any use outside of
>>> the DMA code.
>>
>> There may not be any user user yet, but I'd surely like to see the
>> accessors. This isn't very different from the stub functions you add in
>> patch #2.
>
> If you foresee this being useful in general, do you reckon it would be
> worth decoupling it under its own irqchip-layer Kconfig which can then
> be selected by IOMMU_DMA?
I think that'd be a useful thing to do, as most architectures do not
require this dynamic mapping of MSIs.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2019-04-23 13:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-18 17:26 [PATCH 0/7] iommu/dma-iommu: Split iommu_dma_map_msi_msg in two parts Julien Grall
2019-04-18 17:26 ` [PATCH 1/7] genirq/msi: Add a new field in msi_desc to store an IOMMU cookie Julien Grall
2019-04-18 19:28 ` Thomas Gleixner
2019-04-23 9:26 ` Julien Grall
2019-04-23 10:23 ` Marc Zyngier
2019-04-23 10:51 ` Julien Grall
2019-04-23 11:46 ` Marc Zyngier
2019-04-23 13:19 ` Robin Murphy
2019-04-23 13:42 ` Marc Zyngier [this message]
2019-04-18 17:26 ` [PATCH 2/7] iommu/dma-iommu: Split iommu_dma_map_msi_msg in two parts Julien Grall
2019-04-23 7:08 ` Christoph Hellwig
2019-04-23 10:55 ` Julien Grall
2019-04-23 10:54 ` Marc Zyngier
2019-04-29 13:14 ` Julien Grall
2019-04-18 17:26 ` [PATCH 3/7] irqchip/gicv2m: Don't map the MSI page in gicv2m_compose_msi_msg Julien Grall
2019-04-18 17:26 ` [PATCH 4/7] irqchip/gic-v3-its: Don't map the MSI page in its_irq_compose_msi_msg Julien Grall
2019-04-18 17:26 ` [PATCH 5/7] irqchip/ls-scfg-msi: Don't map the MSI page in ls_scfg_msi_compose_msg Julien Grall
2019-04-18 17:26 ` [PATCH 6/7] irqchip/gic-v3-mbi: Don't map the MSI page in mbi_compose_m{b, s}i_msg Julien Grall
2019-04-18 17:26 ` [PATCH 7/7] iommu/dma-iommu: Remove iommu_dma_map_msi_msg() Julien Grall
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=6e9fb7c6-ca24-8790-967e-6e01cb6f81da@arm.com \
--to=marc.zyngier@arm.com \
--cc=bigeasy@linutronix.de \
--cc=douliyangs@gmail.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jason@lakedaemon.net \
--cc=joro@8bytes.org \
--cc=julien.grall@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=logang@deltatee.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