[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150128143852.GS1569@arm.com>
Date: Wed, 28 Jan 2015 14:38:52 +0000
From: Will Deacon <will.deacon@....com>
To: Joerg Roedel <joro@...tes.org>
Cc: "iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
Kukjin Kim <kgene@...nel.org>,
David Woodhouse <dwmw2@...radead.org>,
Heiko Stuebner <heiko@...ech.de>,
Hiroshi Doyu <hdoyu@...dia.com>,
Thierry Reding <thierry.reding@...il.com>,
Alex Williamson <alex.williamson@...hat.com>,
Arnd Bergmann <arnd@...db.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Robin Murphy <Robin.Murphy@....com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
"jroedel@...e.de" <jroedel@...e.de>
Subject: Re: [PATCH 4/5] iommu: Make sure a device is always attached to a
domain
On Tue, Jan 27, 2015 at 12:08:58AM +0000, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@...e.de>
>
> Make use of the default domain and re-attach a device to it
> when it is detached from another domain. Also enforce that a
> device has to be in the default domain before it can be
> attached to a different domain.
>
> Signed-off-by: Joerg Roedel <jroedel@...e.de>
> ---
> drivers/iommu/iommu.c | 34 +++++++++++++++++++++++++++++++---
> 1 file changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index b63a550..5080759 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -53,6 +53,7 @@ struct iommu_group {
> int id;
> unsigned dev_cnt;
> struct iommu_domain *default_domain;
> + struct iommu_domain *domain;
> };
>
> struct iommu_device {
> @@ -1040,8 +1041,17 @@ static int iommu_group_do_attach_device(struct device *dev, void *data)
>
> int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group)
> {
> - return iommu_group_for_each_dev(group, domain,
> - iommu_group_do_attach_device);
> + int ret;
> +
> + if (group->default_domain && group->domain != group->default_domain)
> + return -EBUSY;
I think this is now racy with itself and detach, whereas before we always
held the group->mutex by virtue of iommu_group_for_each_dev.
Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists