From: Alexandre Bailon <abailon@baylibre.com> To: Robin Murphy <robin.murphy@arm.com>, yong.wu@mediatek.com, joro@8bytes.org, will@kernel.org Cc: matthias.bgg@gmail.com, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, iommu@lists.linux.dev, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH 2/3] iommu: mediatek: Add support of unmanaged iommu domain Date: Tue, 31 Jan 2023 14:08:04 +0100 [thread overview] Message-ID: <f126c61f-6373-d6c5-59c8-24dea9d9d168@baylibre.com> (raw) In-Reply-To: <741920ba-8637-5e28-695c-699b46351590@arm.com> Hi Robin On 1/30/23 13:04, Robin Murphy wrote: > On 2023-01-30 10:27, Alexandre Bailon wrote: >> Currently, the driver can allocate an unmanaged iommu domain. >> But, this only works for SoC having multiple bank or multiple iova >> region. > > That is for good reason - there is only a single pagetable per bank, so > if there are multiple devices assigned to a single bank, they cannot > possibly be attached to different domains at the same time. Hence why > the banks are modelled as groups. I understand. I am trying to upstream a remoteproc driver but the remote processor is behind the iommu. remoteproc can manage the iommu but it requires an unmanaged domain. I tried a couple of things but this cause code duplication, implies many hacks and not always reliable. Do you have any suggestion ? Thanks, Alexandre > > Thanks, > Robin. > >> This updates the driver to also support unmanaged iommu domain if >> MTK_UNMANAGED_DEVICE is set in the iommu id. >> >> Signed-off-by: Alexandre Bailon <abailon@baylibre.com> >> --- >> drivers/iommu/mtk_iommu.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c >> index 2badd6acfb23d..5884a1ad409a0 100644 >> --- a/drivers/iommu/mtk_iommu.c >> +++ b/drivers/iommu/mtk_iommu.c >> @@ -858,9 +858,15 @@ static int mtk_iommu_get_group_id(struct device >> *dev, const struct mtk_iommu_pla >> static struct iommu_group *mtk_iommu_device_group(struct device *dev) >> { >> struct mtk_iommu_data *c_data = dev_iommu_priv_get(dev), *data; >> + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); >> struct list_head *hw_list = c_data->hw_list; >> struct iommu_group *group; >> int groupid; >> + int i; >> + >> + for (i = 0; i < fwspec->num_ids; i++) >> + if (MTK_M4U_UNMANAGED(fwspec->ids[i])) >> + return iommu_group_alloc(); >> data = mtk_iommu_get_frst_data(hw_list); >> if (!data)
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Bailon <abailon@baylibre.com> To: Robin Murphy <robin.murphy@arm.com>, yong.wu@mediatek.com, joro@8bytes.org, will@kernel.org Cc: matthias.bgg@gmail.com, krzysztof.kozlowski@linaro.org, robh+dt@kernel.org, iommu@lists.linux.dev, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH 2/3] iommu: mediatek: Add support of unmanaged iommu domain Date: Tue, 31 Jan 2023 14:08:04 +0100 [thread overview] Message-ID: <f126c61f-6373-d6c5-59c8-24dea9d9d168@baylibre.com> (raw) In-Reply-To: <741920ba-8637-5e28-695c-699b46351590@arm.com> Hi Robin On 1/30/23 13:04, Robin Murphy wrote: > On 2023-01-30 10:27, Alexandre Bailon wrote: >> Currently, the driver can allocate an unmanaged iommu domain. >> But, this only works for SoC having multiple bank or multiple iova >> region. > > That is for good reason - there is only a single pagetable per bank, so > if there are multiple devices assigned to a single bank, they cannot > possibly be attached to different domains at the same time. Hence why > the banks are modelled as groups. I understand. I am trying to upstream a remoteproc driver but the remote processor is behind the iommu. remoteproc can manage the iommu but it requires an unmanaged domain. I tried a couple of things but this cause code duplication, implies many hacks and not always reliable. Do you have any suggestion ? Thanks, Alexandre > > Thanks, > Robin. > >> This updates the driver to also support unmanaged iommu domain if >> MTK_UNMANAGED_DEVICE is set in the iommu id. >> >> Signed-off-by: Alexandre Bailon <abailon@baylibre.com> >> --- >> drivers/iommu/mtk_iommu.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c >> index 2badd6acfb23d..5884a1ad409a0 100644 >> --- a/drivers/iommu/mtk_iommu.c >> +++ b/drivers/iommu/mtk_iommu.c >> @@ -858,9 +858,15 @@ static int mtk_iommu_get_group_id(struct device >> *dev, const struct mtk_iommu_pla >> static struct iommu_group *mtk_iommu_device_group(struct device *dev) >> { >> struct mtk_iommu_data *c_data = dev_iommu_priv_get(dev), *data; >> + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); >> struct list_head *hw_list = c_data->hw_list; >> struct iommu_group *group; >> int groupid; >> + int i; >> + >> + for (i = 0; i < fwspec->num_ids; i++) >> + if (MTK_M4U_UNMANAGED(fwspec->ids[i])) >> + return iommu_group_alloc(); >> data = mtk_iommu_get_frst_data(hw_list); >> if (!data) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-01-31 13:07 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-30 10:27 [PATCH 0/3] Add support of unmanaged domain to mediatek IOMMU Alexandre Bailon 2023-01-30 10:27 ` Alexandre Bailon 2023-01-30 10:27 ` [PATCH 1/3] dt-bindings: memory: mediatek: Add support of unmanaged iommu domain Alexandre Bailon 2023-01-30 10:27 ` Alexandre Bailon 2023-01-30 11:57 ` Alexandre Mergnat 2023-01-30 11:57 ` Alexandre Mergnat 2023-01-30 11:58 ` Robin Murphy 2023-01-30 11:58 ` Robin Murphy 2023-01-30 10:27 ` [PATCH 2/3] iommu: " Alexandre Bailon 2023-01-30 10:27 ` Alexandre Bailon 2023-01-30 12:04 ` Alexandre Mergnat 2023-01-30 12:04 ` Alexandre Mergnat 2023-01-30 12:04 ` Robin Murphy 2023-01-30 12:04 ` Robin Murphy 2023-01-31 13:08 ` Alexandre Bailon [this message] 2023-01-31 13:08 ` Alexandre Bailon 2023-01-31 14:15 ` Robin Murphy 2023-01-31 14:15 ` Robin Murphy 2023-01-31 15:31 ` Alexandre Bailon 2023-01-31 15:31 ` Alexandre Bailon 2023-02-14 5:48 ` Yong Wu (吴勇) 2023-02-14 5:48 ` Yong Wu (吴勇) 2023-09-14 8:07 ` Alexandre Bailon 2023-09-14 8:07 ` Alexandre Bailon 2023-09-14 14:19 ` Robin Murphy 2023-09-14 14:19 ` Robin Murphy 2023-01-30 10:27 ` [PATCH 3/3] dt-bindings: iommu: memory: Use unmanaged iommu domain for the APU Alexandre Bailon 2023-01-30 10:27 ` Alexandre Bailon 2023-01-30 12:04 ` Alexandre Mergnat 2023-01-30 12:04 ` Alexandre Mergnat 2023-01-30 22:50 ` Rob Herring 2023-01-30 22:50 ` Rob Herring
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=f126c61f-6373-d6c5-59c8-24dea9d9d168@baylibre.com \ --to=abailon@baylibre.com \ --cc=devicetree@vger.kernel.org \ --cc=iommu@lists.linux.dev \ --cc=joro@8bytes.org \ --cc=krzysztof.kozlowski@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=matthias.bgg@gmail.com \ --cc=robh+dt@kernel.org \ --cc=robin.murphy@arm.com \ --cc=will@kernel.org \ --cc=yong.wu@mediatek.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.