All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikko Perttunen <cyndis@kapsi.fi>
To: Robin Murphy <robin.murphy@arm.com>, joro@8bytes.org
Cc: architt@codeaurora.org, jonathanh@nvidia.com,
	iommu@lists.linux-foundation.org, thierry.reding@gmail.com,
	srinivas.kandagatla@linaro.org, linux-tegra@vger.kernel.org,
	sricharan@codeaurora.org, linux-arm-kernel@lists.infradead.org,
	hdoyu@nvidia.com
Subject: Re: [PATCH 2/4] iommu/tegra-smmu: Add iommu_group support
Date: Wed, 2 Aug 2017 11:12:54 +0300	[thread overview]
Message-ID: <bdaaf96b-e6cd-fd4a-91e4-3212d94afb57@kapsi.fi> (raw)
In-Reply-To: <7a6819a5a71c4b85db536169f71a4c087afb60f4.1500637633.git.robin.murphy@arm.com>

Tested-by: Mikko Perttunen <mperttunen@nvidia.com>

(Jetson TX1 / Tegra210 with Host1x/VIC behind IOMMU)

On 21.07.2017 15:12, Robin Murphy wrote:
> As the last step to making groups mandatory, clean up the remaining
> drivers by adding basic support. Whilst it may not perfectly reflect
> the isolation capabilities of the hardware (tegra_smmu_swgroup sounds
> suspiciously like something that might warrant representing at the
> iommu_group level), using generic_device_group() should at least
> maintain existing behaviour with respect to the API.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/iommu/tegra-smmu.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
> index eeb19f560a05..faa9c1e70482 100644
> --- a/drivers/iommu/tegra-smmu.c
> +++ b/drivers/iommu/tegra-smmu.c
> @@ -704,6 +704,7 @@ static struct tegra_smmu *tegra_smmu_find(struct device_node *np)
>  static int tegra_smmu_add_device(struct device *dev)
>  {
>  	struct device_node *np = dev->of_node;
> +	struct iommu_group *group;
>  	struct of_phandle_args args;
>  	unsigned int index = 0;
>
> @@ -725,12 +726,19 @@ static int tegra_smmu_add_device(struct device *dev)
>  		index++;
>  	}
>
> +	group = iommu_group_get_for_dev(dev);
> +	if (IS_ERR(group))
> +		return PTR_ERR(group);
> +
> +	iommu_group_put(group);
> +
>  	return 0;
>  }
>
>  static void tegra_smmu_remove_device(struct device *dev)
>  {
>  	dev->archdata.iommu = NULL;
> +	iommu_group_remove_device(dev);
>  }
>
>  static const struct iommu_ops tegra_smmu_ops = {
> @@ -741,6 +749,7 @@ static const struct iommu_ops tegra_smmu_ops = {
>  	.detach_dev = tegra_smmu_detach_dev,
>  	.add_device = tegra_smmu_add_device,
>  	.remove_device = tegra_smmu_remove_device,
> +	.device_group = generic_device_group,
>  	.map = tegra_smmu_map,
>  	.unmap = tegra_smmu_unmap,
>  	.map_sg = default_iommu_map_sg,
>

WARNING: multiple messages have this Message-ID (diff)
From: cyndis@kapsi.fi (Mikko Perttunen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] iommu/tegra-smmu: Add iommu_group support
Date: Wed, 2 Aug 2017 11:12:54 +0300	[thread overview]
Message-ID: <bdaaf96b-e6cd-fd4a-91e4-3212d94afb57@kapsi.fi> (raw)
In-Reply-To: <7a6819a5a71c4b85db536169f71a4c087afb60f4.1500637633.git.robin.murphy@arm.com>

Tested-by: Mikko Perttunen <mperttunen@nvidia.com>

(Jetson TX1 / Tegra210 with Host1x/VIC behind IOMMU)

On 21.07.2017 15:12, Robin Murphy wrote:
> As the last step to making groups mandatory, clean up the remaining
> drivers by adding basic support. Whilst it may not perfectly reflect
> the isolation capabilities of the hardware (tegra_smmu_swgroup sounds
> suspiciously like something that might warrant representing at the
> iommu_group level), using generic_device_group() should at least
> maintain existing behaviour with respect to the API.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/iommu/tegra-smmu.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
> index eeb19f560a05..faa9c1e70482 100644
> --- a/drivers/iommu/tegra-smmu.c
> +++ b/drivers/iommu/tegra-smmu.c
> @@ -704,6 +704,7 @@ static struct tegra_smmu *tegra_smmu_find(struct device_node *np)
>  static int tegra_smmu_add_device(struct device *dev)
>  {
>  	struct device_node *np = dev->of_node;
> +	struct iommu_group *group;
>  	struct of_phandle_args args;
>  	unsigned int index = 0;
>
> @@ -725,12 +726,19 @@ static int tegra_smmu_add_device(struct device *dev)
>  		index++;
>  	}
>
> +	group = iommu_group_get_for_dev(dev);
> +	if (IS_ERR(group))
> +		return PTR_ERR(group);
> +
> +	iommu_group_put(group);
> +
>  	return 0;
>  }
>
>  static void tegra_smmu_remove_device(struct device *dev)
>  {
>  	dev->archdata.iommu = NULL;
> +	iommu_group_remove_device(dev);
>  }
>
>  static const struct iommu_ops tegra_smmu_ops = {
> @@ -741,6 +749,7 @@ static const struct iommu_ops tegra_smmu_ops = {
>  	.detach_dev = tegra_smmu_detach_dev,
>  	.add_device = tegra_smmu_add_device,
>  	.remove_device = tegra_smmu_remove_device,
> +	.device_group = generic_device_group,
>  	.map = tegra_smmu_map,
>  	.unmap = tegra_smmu_unmap,
>  	.map_sg = default_iommu_map_sg,
>

  reply	other threads:[~2017-08-02  8:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-21 12:12 [PATCH 0/4] IOMMU group cleanup Robin Murphy
2017-07-21 12:12 ` Robin Murphy
     [not found] ` <cover.1500637633.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2017-07-21 12:12   ` [PATCH 1/4] iommu/msm: Add iommu_group support Robin Murphy
2017-07-21 12:12     ` Robin Murphy
     [not found]     ` <b87d44e09fa18efbb9daf6258c1f8ecbedaac23c.1500637633.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2017-07-24  7:34       ` Sricharan R
2017-07-24  7:34         ` Sricharan R
     [not found]         ` <f5071164-c965-b6bf-c330-90ff6ea0c956-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-07-24  9:55           ` Robin Murphy
2017-07-24  9:55             ` Robin Murphy
     [not found]             ` <e148ac58-2fda-454f-c8b1-e01dd1c1347c-5wv7dgnIgG8@public.gmane.org>
2017-07-26 15:29               ` Sricharan R
2017-07-26 15:29                 ` Sricharan R
2017-07-21 12:12   ` [PATCH 2/4] iommu/tegra-smmu: " Robin Murphy
2017-07-21 12:12     ` Robin Murphy
2017-08-02  8:12     ` Mikko Perttunen [this message]
2017-08-02  8:12       ` Mikko Perttunen
2017-07-21 12:12   ` [PATCH 3/4] iommu/tegra-gart: " Robin Murphy
2017-07-21 12:12     ` Robin Murphy
     [not found]     ` <9c3fa9661e8177f0ccea960dd584a05fc19f92c8.1500637633.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2017-07-26 20:56       ` Dmitry Osipenko
2017-07-26 20:56         ` Dmitry Osipenko
2017-07-21 12:12   ` [PATCH 4/4] iommu: Finish making iommu_group support mandatory Robin Murphy
2017-07-21 12:12     ` Robin Murphy
2017-07-26 11:12   ` [PATCH 0/4] IOMMU group cleanup Joerg Roedel
2017-07-26 11:12     ` Joerg Roedel
2017-08-11 15:21   ` Joerg Roedel
2017-08-11 15:21     ` Joerg Roedel

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=bdaaf96b-e6cd-fd4a-91e4-3212d94afb57@kapsi.fi \
    --to=cyndis@kapsi.fi \
    --cc=architt@codeaurora.org \
    --cc=hdoyu@nvidia.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sricharan@codeaurora.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=thierry.reding@gmail.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 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.