[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49bca506-1f6a-ab2d-fac0-302073737af7@linux.intel.com>
Date: Wed, 11 Dec 2019 08:54:21 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Jerry Snitselaar <jsnitsel@...hat.com>,
linux-kernel@...r.kernel.org
Cc: baolu.lu@...ux.intel.com, Joerg Roedel <jroedel@...e.de>,
iommu@...ts.linux-foundation.org, stable@...r.kernel.org
Subject: Re: [PATCH] iommu: set group default domain before creating direct
mappings
Hi,
On 12/11/19 2:56 AM, Jerry Snitselaar wrote:
> iommu_group_create_direct_mappings uses group->default_domain, but
> right after it is called, request_default_domain_for_dev calls
> iommu_domain_free for the default domain, and sets the group default
> domain to a different domain. Move the
> iommu_group_create_direct_mappings call to after the group default
> domain is set, so the direct mappings get associated with that domain.
>
> Cc: Joerg Roedel <jroedel@...e.de>
> Cc: Lu Baolu <baolu.lu@...ux.intel.com>
This fix looks good to me.
Reviewed-by: Lu Baolu <baolu.lu@...ux.intel.com>
Best regards,
baolu
> Cc: iommu@...ts.linux-foundation.org
> Cc: stable@...r.kernel.org
> Fixes: 7423e01741dd ("iommu: Add API to request DMA domain for device")
> Signed-off-by: Jerry Snitselaar <jsnitsel@...hat.com>
> ---
> drivers/iommu/iommu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index db7bfd4f2d20..fa908179b80b 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2282,13 +2282,13 @@ request_default_domain_for_dev(struct device *dev, unsigned long type)
> goto out;
> }
>
> - iommu_group_create_direct_mappings(group, dev);
> -
> /* Make the domain the default for this group */
> if (group->default_domain)
> iommu_domain_free(group->default_domain);
> group->default_domain = domain;
>
> + iommu_group_create_direct_mappings(group, dev);
> +
> dev_info(dev, "Using iommu %s mapping\n",
> type == IOMMU_DOMAIN_DMA ? "dma" : "direct");
>
>
Powered by blists - more mailing lists