From: Lu Baolu <baolu.lu@linux•intel.com>
To: Tom Murphy <murphyt7@tcd•ie>, iommu@lists•linux-foundation.org
Cc: Heiko Stuebner <heiko@sntech•de>,
kvm@vger•kernel.org, David Airlie <airlied@linux•ie>,
Joonas Lahtinen <joonas.lahtinen@linux•intel.com>,
dri-devel@lists•freedesktop.org,
Bjorn Andersson <bjorn.andersson@linaro•org>,
linux-tegra@vger•kernel.org, Julien Grall <julien.grall@arm•com>,
Thierry Reding <thierry.reding@gmail•com>,
Will Deacon <will@kernel•org>,
Marek Szyprowski <m.szyprowski@samsung•com>,
Jean-Philippe Brucker <jean-philippe@linaro•org>,
linux-samsung-soc@vger•kernel.org, Marc Zyngier <maz@kernel•org>,
Joerg Roedel <joro@8bytes•org>,
Krzysztof Kozlowski <krzk@kernel•org>,
Jonathan Hunter <jonathanh@nvidia•com>,
linux-rockchip@lists•infradead.org,
Andy Gross <agross@kernel•org>,
linux-arm-kernel@lists•infradead.org, linux-s390@vger•kernel.org,
linux-arm-msm@vger•kernel.org, intel-gfx@lists•freedesktop.org,
Jani Nikula <jani.nikula@linux•intel.com>,
Eric Auger <eric.auger@redhat•com>,
Alex Williamson <alex.williamson@redhat•com>,
linux-mediatek@lists•infradead.org,
Rodrigo Vivi <rodrigo.vivi@intel•com>,
Matthias Brugger <matthias.bgg@gmail•com>,
Thomas Gleixner <tglx@linutronix•de>,
virtualization@lists•linux-foundation.org,
Gerald Schaefer <gerald.schaefer@de•ibm.com>,
David Woodhouse <dwmw2@infradead•org>,
Cornelia Huck <cohuck@redhat•com>,
linux-kernel@vger•kernel.org, Rob Clark <robdclark@gmail•com>,
Kukjin Kim <kgene@kernel•org>, Daniel Vetter <daniel@ffwll•ch>,
Robin Murphy <robin.murphy@arm•com>,
baolu.lu@linux•intel.com
Subject: Re: [PATCH 1/8] iommu/vt-d: clean up 32bit si_domain assignment
Date: Mon, 23 Dec 2019 11:00:47 +0800 [thread overview]
Message-ID: <e569e246-11a1-e8bd-9347-310284e96885@linux.intel.com> (raw)
In-Reply-To: <20191221150402.13868-2-murphyt7@tcd.ie>
Hi,
On 12/21/19 11:03 PM, Tom Murphy wrote:
> @@ -5618,9 +5583,13 @@ static int intel_iommu_add_device(struct device *dev)
> struct iommu_domain *domain;
> struct intel_iommu *iommu;
> struct iommu_group *group;
> + u64 dma_mask = *dev->dma_mask;
> u8 bus, devfn;
> int ret;
>
> + if (dev->coherent_dma_mask && dev->coherent_dma_mask < dma_mask)
> + dma_mask = dev->coherent_dma_mask;
> +
> iommu = device_to_iommu(dev, &bus, &devfn);
> if (!iommu)
> return -ENODEV;
> @@ -5640,7 +5609,12 @@ static int intel_iommu_add_device(struct device *dev)
> domain = iommu_get_domain_for_dev(dev);
> dmar_domain = to_dmar_domain(domain);
> if (domain->type == IOMMU_DOMAIN_DMA) {
> - if (device_def_domain_type(dev) == IOMMU_DOMAIN_IDENTITY) {
> + /*
> + * We check dma_mask >= dma_get_required_mask(dev) because
> + * 32 bit DMA falls back to non-identity mapping.
> + */
> + if (device_def_domain_type(dev) == IOMMU_DOMAIN_IDENTITY &&
> + dma_mask >= dma_get_required_mask(dev)) {
> ret = iommu_request_dm_for_dev(dev);
> if (ret) {
> dmar_remove_one_dev_info(dev);
dev->dma_mask is set to 32bit by default. During loading driver, it sets
the real dma_mask with dma_set_mask() according to the real capability.
Here you will always see 32bit dma_mask for each device.
Best regards,
baolu
_______________________________________________
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:[~2019-12-23 3:02 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-21 15:03 [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api Tom Murphy
2019-12-21 15:03 ` [PATCH 1/8] iommu/vt-d: clean up 32bit si_domain assignment Tom Murphy
2019-12-21 23:46 ` Arvind Sankar
2019-12-23 3:00 ` Lu Baolu [this message]
2019-12-21 15:03 ` [PATCH 2/8] iommu/vt-d: Use default dma_direct_* mapping functions for direct mapped devices Tom Murphy
2019-12-21 15:03 ` [PATCH 3/8] iommu/vt-d: Remove IOVA handling code from non-dma_ops path Tom Murphy
2020-03-20 6:30 ` Tom Murphy
2020-03-20 7:06 ` Lu Baolu
2019-12-21 15:03 ` [PATCH 4/8] iommu: Handle freelists when using deferred flushing in iommu drivers Tom Murphy
2019-12-21 15:03 ` [PATCH 5/8] iommu: Add iommu_dma_free_cpu_cached_iovas function Tom Murphy
2019-12-21 15:03 ` [PATCH 6/8] iommu: allow the dma-iommu api to use bounce buffers Tom Murphy
2019-12-24 10:20 ` kbuild test robot
2019-12-21 15:03 ` [PATCH 7/8] iommu/vt-d: Convert intel iommu driver to the iommu ops Tom Murphy
2019-12-21 15:04 ` [PATCH 8/8] DO NOT MERGE: iommu: disable list appending in dma-iommu Tom Murphy
2019-12-23 10:37 ` [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api Jani Nikula
2019-12-23 11:29 ` Robin Murphy
2019-12-23 11:41 ` Jani Nikula
2020-03-20 6:28 ` Tom Murphy
2020-05-29 0:00 ` Logan Gunthorpe
2020-05-29 12:45 ` Christoph Hellwig
2020-05-29 19:05 ` Logan Gunthorpe
2020-05-29 21:11 ` Marek Szyprowski
2020-05-29 21:21 ` Logan Gunthorpe
2020-08-24 0:04 ` Tom Murphy
2020-08-26 18:26 ` Alex Deucher
2020-08-27 21:36 ` Logan Gunthorpe
2020-08-27 23:34 ` Tom Murphy
2020-09-03 20:26 ` Tom Murphy
2020-09-08 15:28 ` [Intel-gfx] " Tvrtko Ursulin
2020-09-08 15:44 ` Logan Gunthorpe
2020-09-08 15:56 ` Tvrtko Ursulin
2020-09-08 22:43 ` Tom Murphy
2020-09-09 9:16 ` Tvrtko Ursulin
2020-09-09 12:55 ` Tvrtko Ursulin
2020-09-10 13:33 ` Tom Murphy
2020-09-10 13:34 ` Tom Murphy
2020-08-26 18:14 ` Robin Murphy
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=e569e246-11a1-e8bd-9347-310284e96885@linux.intel.com \
--to=baolu.lu@linux$(echo .)intel.com \
--cc=agross@kernel$(echo .)org \
--cc=airlied@linux$(echo .)ie \
--cc=alex.williamson@redhat$(echo .)com \
--cc=bjorn.andersson@linaro$(echo .)org \
--cc=cohuck@redhat$(echo .)com \
--cc=daniel@ffwll$(echo .)ch \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=dwmw2@infradead$(echo .)org \
--cc=eric.auger@redhat$(echo .)com \
--cc=gerald.schaefer@de$(echo .)ibm.com \
--cc=heiko@sntech$(echo .)de \
--cc=intel-gfx@lists$(echo .)freedesktop.org \
--cc=iommu@lists$(echo .)linux-foundation.org \
--cc=jani.nikula@linux$(echo .)intel.com \
--cc=jean-philippe@linaro$(echo .)org \
--cc=jonathanh@nvidia$(echo .)com \
--cc=joonas.lahtinen@linux$(echo .)intel.com \
--cc=joro@8bytes$(echo .)org \
--cc=julien.grall@arm$(echo .)com \
--cc=kgene@kernel$(echo .)org \
--cc=krzk@kernel$(echo .)org \
--cc=kvm@vger$(echo .)kernel.org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-arm-msm@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-mediatek@lists$(echo .)infradead.org \
--cc=linux-rockchip@lists$(echo .)infradead.org \
--cc=linux-s390@vger$(echo .)kernel.org \
--cc=linux-samsung-soc@vger$(echo .)kernel.org \
--cc=linux-tegra@vger$(echo .)kernel.org \
--cc=m.szyprowski@samsung$(echo .)com \
--cc=matthias.bgg@gmail$(echo .)com \
--cc=maz@kernel$(echo .)org \
--cc=murphyt7@tcd$(echo .)ie \
--cc=robdclark@gmail$(echo .)com \
--cc=robin.murphy@arm$(echo .)com \
--cc=rodrigo.vivi@intel$(echo .)com \
--cc=tglx@linutronix$(echo .)de \
--cc=thierry.reding@gmail$(echo .)com \
--cc=virtualization@lists$(echo .)linux-foundation.org \
--cc=will@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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